]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] Fix DHCP + MASQUERADE problem
authorPatrick McHardy <kaber@trash.net>
Tue, 13 Sep 2005 07:37:22 +0000 (09:37 +0200)
committerChris Wright <chrisw@osdl.org>
Sat, 17 Sep 2005 01:01:57 +0000 (18:01 -0700)
In 2.6.13-rcX the MASQUERADE target was changed not to exclude local
packets for better source address consistency. This breaks DHCP clients
using UDP sockets when the DHCP requests are caught by a MASQUERADE rule
because the MASQUERADE target drops packets when no address is configured
on the outgoing interface. This patch makes it ignore packets with a
source address of 0.

Thanks to Rusty for this suggestion.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Chris Wright <chrisw@osdl.org>
net/ipv4/netfilter/ipt_MASQUERADE.c

index 91e74502c3d36ae652eca8041cc8dc66690eaf44..4c8d6ef423bc6a744380415ff619c5926f6c405a 100644 (file)
@@ -95,6 +95,12 @@ masquerade_target(struct sk_buff **pskb,
        IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
                            || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
 
+       /* Source address is 0.0.0.0 - locally generated packet that is
+        * probably not supposed to be masqueraded.
+        */
+       if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == 0)
+               return NF_ACCEPT;
+
        mr = targinfo;
        rt = (struct rtable *)(*pskb)->dst;
        newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);