12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 #include <linux/module.h>
15 #include <linux/slab.h>
17 #include <linux/udp.h>
18 #include <linux/icmp.h>
24 #include <linux/netfilter/x_tables.h>
25 #include <linux/netfilter_ipv4/ip_tables.h>
27 #ifdef CONFIG_BRIDGE_NETFILTER
28 #include <linux/netfilter_bridge.h>
36 static void send_reset(
struct sk_buff *oldskb,
int hook)
39 const struct iphdr *oiph;
42 struct tcphdr _otcph, *tcph;
48 oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb),
49 sizeof(_otcph), &_otcph);
63 oiph = ip_hdr(oldskb);
65 nskb = alloc_skb(
sizeof(
struct iphdr) +
sizeof(
struct tcphdr) +
72 skb_reset_network_header(nskb);
75 niph->ihl =
sizeof(
struct iphdr) / 4;
85 memset(tcph, 0,
sizeof(*tcph));
88 tcph->doff =
sizeof(
struct tcphdr) / 4;
94 oldskb->
len - ip_hdrlen(oldskb) -
113 niph->
ttl = ip4_dst_hoplimit(skb_dst(nskb));
116 if (nskb->
len > dst_mtu(skb_dst(nskb)))
119 nf_ct_attach(nskb, oldskb);
128 static inline void send_unreach(
struct sk_buff *skb_in,
int code)
138 switch (reject->
with) {
176 pr_info(
"ECHOREPLY no longer supported.\n");
182 pr_info(
"TCP_RESET invalid for non-tcp\n");
197 .checkentry = reject_tg_check,
201 static int __init reject_tg_init(
void)
206 static void __exit reject_tg_exit(
void)