patch-2.4.23 linux-2.4.23/net/ipv4/netfilter/ipt_REJECT.c
Next file: linux-2.4.23/net/ipv4/netfilter/ipt_ah.c
Previous file: linux-2.4.23/net/ipv4/netfilter/ipt_REDIRECT.c
Back to the patch index
Back to the overall index
- Lines: 48
- Date:
2003-11-28 10:26:21.000000000 -0800
- Orig file:
linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c
- Orig date:
2003-08-25 04:44:44.000000000 -0700
diff -urN linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c linux-2.4.23/net/ipv4/netfilter/ipt_REJECT.c
@@ -34,16 +34,17 @@
attach(new_skb, nfct);
}
-static inline struct rtable *route_reverse(struct sk_buff *skb, int local)
+static inline struct rtable *route_reverse(struct sk_buff *skb, int hook)
{
struct iphdr *iph = skb->nh.iph;
struct dst_entry *odst;
struct rt_key key = {};
struct rtable *rt;
- if (local) {
+ if (hook != NF_IP_FORWARD) {
key.dst = iph->saddr;
- key.src = iph->daddr;
+ if (hook == NF_IP_LOCAL_IN)
+ key.src = iph->daddr;
key.tos = RT_TOS(iph->tos);
if (ip_route_output_key(&rt, &key) != 0)
@@ -75,7 +76,7 @@
}
/* Send RST reply */
-static void send_reset(struct sk_buff *oldskb, int local)
+static void send_reset(struct sk_buff *oldskb, int hook)
{
struct sk_buff *nskb;
struct tcphdr *otcph, *tcph;
@@ -104,7 +105,7 @@
csum_partial((char *)otcph, otcplen, 0)) != 0)
return;
- if ((rt = route_reverse(oldskb, local)) == NULL)
+ if ((rt = route_reverse(oldskb, hook)) == NULL)
return;
hh_len = (rt->u.dst.dev->hard_header_len + 15)&~15;
@@ -372,7 +373,7 @@
send_unreach(*pskb, ICMP_PKT_FILTERED);
break;
case IPT_TCP_RESET:
- send_reset(*pskb, hooknum == NF_IP_LOCAL_IN);
+ send_reset(*pskb, hooknum);
case IPT_ICMP_ECHOREPLY:
/* Doesn't happen. */
break;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)