From: Harald Welte <laforge@netfilter.org>
To: "David S. Miller" <davem@redhat.com>
Cc: diadon@isfera.ru, netfilter-devel@lists.netfilter.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
Date: Mon, 22 Sep 2003 14:21:59 +0200 [thread overview]
Message-ID: <20030922122159.GK31401@sunbeam.de.gnumonks.org> (raw)
In-Reply-To: <20030922020205.6b239e71.davem@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2586 bytes --]
On Mon, Sep 22, 2003 at 02:02:05AM -0700, David S. Miller wrote:
> Already pushed to Marcelo, just send me the fix I should apply
> on top once you have this issue solved.
Ok, here goes the (confirmed to be working) fix. TIA.
diff -Nru linux-2.4.22-laforge/net/ipv4/netfilter/ipt_REJECT.c linux-2.4.22-kaber/net/ipv4/netfilter/ipt_REJECT.c
--- linux-2.4.22-laforge/net/ipv4/netfilter/ipt_REJECT.c 2003-09-22 14:29:05.000000000 +0200
+++ linux-2.4.22-kaber/net/ipv4/netfilter/ipt_REJECT.c 2003-09-22 14:26:54.000000000 +0200
@@ -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;
@@ -186,8 +187,8 @@
nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
nskb->nh.iph->ihl);
- /* dst->pmtu can be zero because it is not set for local dst's */
- if (nskb->dst->pmtu && nskb->len > nskb->dst->pmtu)
+ /* "Never happens" */
+ if (nskb->len > nskb->dst->pmtu)
goto free_nskb;
connection_attach(nskb, oldskb->nfct);
@@ -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;
--
- Harald Welte <laforge@netfilter.org> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2003-09-22 12:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-21 14:40 Harald Welte
2003-09-22 1:16 ` David S. Miller
2003-09-22 8:16 ` Diadon
2003-09-22 8:53 ` Harald Welte
2003-09-22 9:02 ` David S. Miller
2003-09-22 11:13 ` Diadon
2003-09-22 12:21 ` Harald Welte [this message]
2003-09-23 19:43 ` David S. Miller
2003-09-22 11:08 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030922122159.GK31401@sunbeam.de.gnumonks.org \
--to=laforge@netfilter.org \
--cc=davem@redhat.com \
--cc=diadon@isfera.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®