Skip to contentSkip to conversation

: Fix DHCP + MASQUERADE problem

PATCH In review Patrick McHardy 2 participants 2 messages Sep 13, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 : Fix DHCP + MASQUERADE problem

This is the fix for the DHCP+MASQUERADE regression.

@the -stable people: please apply this patch to -stable. To avoid confusion, only this patch (4/4) is meant for -stable, the first three patches were not CCed.

[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.

---
commit 5048a58f5d9643ca88593cda13433006599b77d3
tree fec8093ebdf5c8f44c87492fadcedbb7ad40f6ae
parent 9af9e2ec732d00e62b458b46829bc696987d68af
author Patrick McHardy <[email protected]> Tue, 13 Sep 2005 09:32:06 +0200 committer Patrick McHardy <[email protected]> Tue, 13 Sep 2005 09:32:06 +0200

 net/ipv4/netfilter/ipt_MASQUERADE.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/ipv4/netfilter/ipt_MASQUERADE.c +6 -0
@@ -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);
maintainer
#1 lore raw

All 4 patches applied, thanks Patrick.
Thanks for remembering to submit the last
one to -stable.