* [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
@ 2003-09-21 14:40 ` Harald Welte
0 siblings, 0 replies; 13+ messages in thread
From: Harald Welte @ 2003-09-21 14:40 UTC (permalink / raw)
To: David Miller; +Cc: Netfilter Development Mailinglist, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 764 bytes --]
Hi Dave!
Some people use REJECT in the OUTPUT chain (rejecting locally generated
packets). This didn't work anymore starting with some fixes we did in 2.4.22.
A dst_entry for a local source doesn't contain pmtu information - and
thus the newly-created packet would instantly be dropped again.
I'll send you a 2.6.x merge for this later.
Please apply the following fix, thanks
--
- 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 #1.2: 75_REJECT_localpmtu-fix.patch --]
[-- Type: text/plain, Size: 847 bytes --]
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c
--- linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c 2003-09-21 16:39:25.000000000 +0200
@@ -186,8 +186,8 @@
nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
nskb->nh.iph->ihl);
- /* "Never happens" */
- if (nskb->len > nskb->dst->pmtu)
+ /* dst->pmtu can be zero because it is not set for local dst's */
+ if (nskb->dst->pmtu && nskb->len > nskb->dst->pmtu)
goto free_nskb;
connection_attach(nskb, oldskb->nfct);
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
@ 2003-09-21 14:40 ` Harald Welte
0 siblings, 0 replies; 13+ messages in thread
From: Harald Welte @ 2003-09-21 14:40 UTC (permalink / raw)
To: David Miller; +Cc: Netfilter Development Mailinglist, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 764 bytes --]
Hi Dave!
Some people use REJECT in the OUTPUT chain (rejecting locally generated
packets). This didn't work anymore starting with some fixes we did in 2.4.22.
A dst_entry for a local source doesn't contain pmtu information - and
thus the newly-created packet would instantly be dropped again.
I'll send you a 2.6.x merge for this later.
Please apply the following fix, thanks
--
- 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 #1.2: 75_REJECT_localpmtu-fix.patch --]
[-- Type: text/plain, Size: 847 bytes --]
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c
--- linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c 2003-09-21 16:39:25.000000000 +0200
@@ -186,8 +186,8 @@
nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
nskb->nh.iph->ihl);
- /* "Never happens" */
- if (nskb->len > nskb->dst->pmtu)
+ /* dst->pmtu can be zero because it is not set for local dst's */
+ if (nskb->dst->pmtu && nskb->len > nskb->dst->pmtu)
goto free_nskb;
connection_attach(nskb, oldskb->nfct);
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-21 14:40 ` Harald Welte
(?)
@ 2003-09-22 1:16 ` David S. Miller
-1 siblings, 0 replies; 13+ messages in thread
From: David S. Miller @ 2003-09-22 1:16 UTC (permalink / raw)
To: Harald Welte; +Cc: netfilter-devel, linux-kernel
On Sun, 21 Sep 2003 16:40:13 +0200
Harald Welte <laforge@netfilter.org> wrote:
> Some people use REJECT in the OUTPUT chain (rejecting locally generated
> packets). This didn't work anymore starting with some fixes we did in 2.4.22.
> A dst_entry for a local source doesn't contain pmtu information - and
> thus the newly-created packet would instantly be dropped again.
Applied to 2.4.x, thanks Harald.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-21 14:40 ` Harald Welte
@ 2003-09-22 8:16 ` Diadon
-1 siblings, 0 replies; 13+ messages in thread
From: Diadon @ 2003-09-22 8:16 UTC (permalink / raw)
To: Harald Welte
Cc: David Miller, Netfilter Development Mailinglist, linux-kernel
That patch is not work, after patching the kernel problem is not
disappeared!
Patch by Patrick is working fine and fix this problem
Harald Welte wrote:
>Hi Dave!
>
>Some people use REJECT in the OUTPUT chain (rejecting locally generated
>packets). This didn't work anymore starting with some fixes we did in 2.4.22.
>A dst_entry for a local source doesn't contain pmtu information - and
>thus the newly-created packet would instantly be dropped again.
>
>I'll send you a 2.6.x merge for this later.
>
>Please apply the following fix, thanks
>
>
>
>------------------------------------------------------------------------
>
>diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c
>--- linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c 2003-08-25 13:44:44.000000000 +0200
>+++ linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c 2003-09-21 16:39:25.000000000 +0200
>@@ -186,8 +186,8 @@
> nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
> nskb->nh.iph->ihl);
>
>- /* "Never happens" */
>- if (nskb->len > nskb->dst->pmtu)
>+ /* dst->pmtu can be zero because it is not set for local dst's */
>+ if (nskb->dst->pmtu && nskb->len > nskb->dst->pmtu)
> goto free_nskb;
>
> connection_attach(nskb, oldskb->nfct);
>
>
>------------------------------------------------------------------------
>
>Scanned by evaliation version of Dr.Web antivirus Daemon
>http://drweb.ru/unix/
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
@ 2003-09-22 8:16 ` Diadon
0 siblings, 0 replies; 13+ messages in thread
From: Diadon @ 2003-09-22 8:16 UTC (permalink / raw)
To: Harald Welte
Cc: David Miller, Netfilter Development Mailinglist, linux-kernel
That patch is not work, after patching the kernel problem is not
disappeared!
Patch by Patrick is working fine and fix this problem
Harald Welte wrote:
>Hi Dave!
>
>Some people use REJECT in the OUTPUT chain (rejecting locally generated
>packets). This didn't work anymore starting with some fixes we did in 2.4.22.
>A dst_entry for a local source doesn't contain pmtu information - and
>thus the newly-created packet would instantly be dropped again.
>
>I'll send you a 2.6.x merge for this later.
>
>Please apply the following fix, thanks
>
>
>
>------------------------------------------------------------------------
>
>diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c
>--- linux-2.4.22/net/ipv4/netfilter/ipt_REJECT.c 2003-08-25 13:44:44.000000000 +0200
>+++ linux-2.4.22-rejectfix/net/ipv4/netfilter/ipt_REJECT.c 2003-09-21 16:39:25.000000000 +0200
>@@ -186,8 +186,8 @@
> nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
> nskb->nh.iph->ihl);
>
>- /* "Never happens" */
>- if (nskb->len > nskb->dst->pmtu)
>+ /* dst->pmtu can be zero because it is not set for local dst's */
>+ if (nskb->dst->pmtu && nskb->len > nskb->dst->pmtu)
> goto free_nskb;
>
> connection_attach(nskb, oldskb->nfct);
>
>
>------------------------------------------------------------------------
>
>Scanned by evaliation version of Dr.Web antivirus Daemon
>http://drweb.ru/unix/
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-22 8:16 ` Diadon
@ 2003-09-22 8:53 ` Harald Welte
-1 siblings, 0 replies; 13+ messages in thread
From: Harald Welte @ 2003-09-22 8:53 UTC (permalink / raw)
To: Diadon; +Cc: David Miller, Netfilter Development Mailinglist, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 677 bytes --]
On Mon, Sep 22, 2003 at 12:16:50PM +0400, Diadon wrote:
> That patch is not work, after patching the kernel problem is not
> disappeared!
>
> Patch by Patrick is working fine and fix this problem
David, pleas defer applying that patch until further testing is done.
Sorry for the confusion.
--
- 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 --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
@ 2003-09-22 8:53 ` Harald Welte
0 siblings, 0 replies; 13+ messages in thread
From: Harald Welte @ 2003-09-22 8:53 UTC (permalink / raw)
To: Diadon; +Cc: David Miller, Netfilter Development Mailinglist, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 677 bytes --]
On Mon, Sep 22, 2003 at 12:16:50PM +0400, Diadon wrote:
> That patch is not work, after patching the kernel problem is not
> disappeared!
>
> Patch by Patrick is working fine and fix this problem
David, pleas defer applying that patch until further testing is done.
Sorry for the confusion.
--
- 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 --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
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
-1 siblings, 2 replies; 13+ messages in thread
From: David S. Miller @ 2003-09-22 9:02 UTC (permalink / raw)
To: Harald Welte; +Cc: diadon, netfilter-devel, linux-kernel
On Mon, 22 Sep 2003 10:53:26 +0200
Harald Welte <laforge@netfilter.org> wrote:
> David, pleas defer applying that patch until further testing is done.
>
> Sorry for the confusion.
Already pushed to Marcelo, just send me the fix I should apply
on top once you have this issue solved.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-22 8:53 ` Harald Welte
@ 2003-09-22 11:08 ` Patrick McHardy
-1 siblings, 0 replies; 13+ messages in thread
From: Patrick McHardy @ 2003-09-22 11:08 UTC (permalink / raw)
To: Harald Welte
Cc: Diadon, David Miller, Netfilter Development Mailinglist, linux-kernel
Harald Welte wrote:
>David, pleas defer applying that patch until further testing is done.
>
>Sorry for the confusion.
>
My bad, I missed that we cannot pass the packet to ip_finish_output2
since it was routed as local input and is missing a neighbour. The correct
fix is to use ip_route_output for packets generated in LOCAL_OUT with
key.saddr set to 0 (the first one I sent to Diadon).
Best regards,
Patrick
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
@ 2003-09-22 11:08 ` Patrick McHardy
0 siblings, 0 replies; 13+ messages in thread
From: Patrick McHardy @ 2003-09-22 11:08 UTC (permalink / raw)
To: Harald Welte
Cc: Diadon, David Miller, Netfilter Development Mailinglist, linux-kernel
Harald Welte wrote:
>David, pleas defer applying that patch until further testing is done.
>
>Sorry for the confusion.
>
My bad, I missed that we cannot pass the packet to ip_finish_output2
since it was routed as local input and is missing a neighbour. The correct
fix is to use ip_route_output for packets generated in LOCAL_OUT with
key.saddr set to 0 (the first one I sent to Diadon).
Best regards,
Patrick
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-22 9:02 ` David S. Miller
@ 2003-09-22 11:13 ` Diadon
2003-09-22 12:21 ` Harald Welte
1 sibling, 0 replies; 13+ messages in thread
From: Diadon @ 2003-09-22 11:13 UTC (permalink / raw)
To: David S. Miller; +Cc: Harald Welte, netfilter-devel, linux-kernel
David S. Miller wrote:
>On Mon, 22 Sep 2003 10:53:26 +0200
>Harald Welte <laforge@netfilter.org> wrote:
>
>
>
>>David, pleas defer applying that patch until further testing is done.
>>
>>Sorry for the confusion.
>>
>>
>
>Already pushed to Marcelo, just send me the fix I should apply
>on top once you have this issue solved.
>
>
>
>
So we're waiting final release of this patch ;)))
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-22 9:02 ` David S. Miller
2003-09-22 11:13 ` Diadon
@ 2003-09-22 12:21 ` Harald Welte
2003-09-23 19:43 ` David S. Miller
1 sibling, 1 reply; 13+ messages in thread
From: Harald Welte @ 2003-09-22 12:21 UTC (permalink / raw)
To: David S. Miller; +Cc: diadon, netfilter-devel, linux-kernel
[-- 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 --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2.4] fix ipt_REJECT when used in OUTPUT
2003-09-22 12:21 ` Harald Welte
@ 2003-09-23 19:43 ` David S. Miller
0 siblings, 0 replies; 13+ messages in thread
From: David S. Miller @ 2003-09-23 19:43 UTC (permalink / raw)
To: Harald Welte; +Cc: diadon, netfilter-devel, linux-kernel
On Mon, 22 Sep 2003 14:21:59 +0200
Harald Welte <laforge@netfilter.org> wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2003-09-23 19:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-21 14:40 [PATCH 2.4] fix ipt_REJECT when used in OUTPUT Harald Welte
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:16 ` Diadon
2003-09-22 8:53 ` Harald Welte
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
2003-09-23 19:43 ` David S. Miller
2003-09-22 11:08 ` Patrick McHardy
2003-09-22 11:08 ` Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.