add CONFIG_IP_NF_MASQUERADE_LOCAL
Subsystems (3)
PATCH 1/1 add CONFIG_IP_NF_MASQUERADE_LOCAL
Hi *,
I have patches witch allow the masuerading of local packets. Now support for DNAT of local packets are in the kernel.
But somebody (like me) could need masuerading of local packets.
e.g. I have a squid proxy listen on a specified ip and it should use this ip when connetion to intra net web servers, but when the it should connect to an internet host this ip should be masueraded.
I running the 2.4 serie with this patch since 2.4.3 and I never had problems with it!
it would be very,very cool if this could be in the main kernel as well.
I didn't wnat to patch the kernel by myself allways! :-)
I attach two patches one for 2.4.21-pre3 and one for 2.5.56
metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <[email protected]>
Documentation/Configure.help +10 -0
@@ -2758,6 +2758,16 @@ CONFIG_IP_NF_TARGET_MASQUERADE If you want to compile it as a module, say M here and read <file:Documentation/modules.txt>. If unsure, say `N'. +Local MASQUERADE support +CONFIG_IP_NF_MASQUERADE_LOCAL + This option enables support for MASQUERADE of + locally originated connections. + + Enable this if you need to use masquerading on connections + originating from local processes on the nat box itself. + + If unsure, say 'N'. + Basic SNMP-ALG support CONFIG_IP_NF_NAT_SNMP_BASIC
net/ipv4/netfilter/Config.in +3 -0
@@ -55,6 +55,9 @@ if [ "$CONFIG_IP_NF_IPTABLES" != "n" ]; if [ "$CONFIG_IP_NF_NAT" != "n" ]; then define_bool CONFIG_IP_NF_NAT_NEEDED y dep_tristate ' MASQUERADE target support' CONFIG_IP_NF_TARGET_MASQUERADE $CONFIG_IP_NF_NAT + if [ "$CONFIG_IP_NF_TARGET_MASQUERADE" != "n" ]; then + bool ' MASQUERADE of local connections (READ HELP)' CONFIG_IP_NF_MASQUERADE_LOCAL $CONFIG_IP_NF_TARGET_MASQUERADE + fi dep_tristate ' REDIRECT target support' CONFIG_IP_NF_TARGET_REDIRECT $CONFIG_IP_NF_NAT bool ' NAT of local connections (READ HELP)' CONFIG_IP_NF_NAT_LOCAL if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
net/ipv4/netfilter/ipt_MASQUERADE.c +2 -2
@@ -73,10 +73,10 @@ masquerade_target(struct sk_buff **pskb,IP_NF_ASSERT (hooknum ==NF_IP_POST_ROUTING ); -/* FIXME: For the moment, don't do local packets, breaks -testsuite for 2.3.49 --RR */ +#ifndef CONFIG_IP_NF_MASQUERADE_LOCAL if ((*pskb)->sk)return NF_ACCEPT ; +#endif /* CONFIG_IP_NF_MASQUERADE_LOCAL */ ct =ip_conntrack_get (*pskb, &ctinfo); IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW
net/ipv4/netfilter/Kconfig +12 -0
@@ -316,6 +316,18 @@ config IP_NF_TARGET_MASQUERADE If you want to compile it as a module, say M here and read <file:Documentation/modules.txt>. If unsure, say `N'. +config IP_NF_MASQUERADE_LOCAL + bool "MASQUERADE of local connections (READ HELP)" + depends on IP_NF_TARGET_MASQUERADE + help + This option enables support for MASQUERADE of + locally originated connections. + + Enable this if you need to use masquerading on connections + originating from local processes on the nat box itself. + + If unsure, say 'N'. + config IP_NF_TARGET_REDIRECT tristate "REDIRECT target support" depends on IP_NF_NAT
net/ipv4/netfilter/ipt_MASQUERADE.c +2 -2
@@ -72,10 +72,10 @@ masquerade_target(struct sk_buff **pskb,IP_NF_ASSERT (hooknum ==NF_IP_POST_ROUTING ); -/* FIXME: For the moment, don't do local packets, breaks -testsuite for 2.3.49 --RR */ +#ifndef CONFIG_IP_NF_MASQUERADE_LOCAL if ((*pskb)->sk)return NF_ACCEPT ; +#endif /* CONFIG_IP_NF_MASQUERADE_LOCAL */ ct =ip_conntrack_get (*pskb, &ctinfo); IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW