]> err.no Git - linux-2.6/commitdiff
[NETFILTER]: Fix DHCP + MASQUERADE problem
authorPatrick McHardy <kaber@trash.net>
Tue, 13 Sep 2005 20:49:15 +0000 (13:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Sep 2005 20:49:15 +0000 (13:49 -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: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ipt_MASQUERADE.c

index 2f3e181c8e97ad2455b0d488d8388b007c1b0a95..275a174c6fe69c56bf2296cb33323d910a34c49e 100644 (file)
@@ -90,6 +90,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);