aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-09-13 16:49:15 -0400
committerDavid S. Miller <davem@davemloft.net>2005-09-13 16:49:15 -0400
commitadcb5ad1e5ba3996d53a047c5486efa6e734b413 (patch)
tree6275dbf6331366bff32bf3d67b44b991f20ed36f
parentcd0bf2d796ebb51c346b1ed4208cdbfd86e98a61 (diff)
[NETFILTER]: Fix DHCP + MASQUERADE problem
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>
-rw-r--r--net/ipv4/netfilter/ipt_MASQUERADE.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
index 2f3e181c8e97..275a174c6fe6 100644
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c
@@ -90,6 +90,12 @@ masquerade_target(struct sk_buff **pskb,
90 IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED 90 IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
91 || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); 91 || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
92 92
93 /* Source address is 0.0.0.0 - locally generated packet that is
94 * probably not supposed to be masqueraded.
95 */
96 if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == 0)
97 return NF_ACCEPT;
98
93 mr = targinfo; 99 mr = targinfo;
94 rt = (struct rtable *)(*pskb)->dst; 100 rt = (struct rtable *)(*pskb)->dst;
95 newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE); 101 newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);