Patchwork [1/1] netfilter : fix hooks for SNAT and DNAT targets

login
register
mail settings
Submitter Elison Niven
Date Oct. 15, 2012, 10:44 a.m.
Message ID <1350297888-3363-1-git-send-email-elison.niven@cyberoam.com>
Download mbox | patch
Permalink /patch/191520/
State Accepted
Headers show

Comments

Elison Niven - Oct. 15, 2012, 10:44 a.m.
Correct hooks for SNAT and DNAT targets in xt_nat.c :
SNAT hooks should be POST_ROUTING and LOCAL_IN.
DNAT hooks should be PRE_ROUTING and LOCAL_OUT.

Signed-off-by: Elison Niven <elison.niven@cyberoam.com>
Signed-off-by: Sanket Shah <sanket.shah@cyberoam.com>
---
 net/netfilter/xt_nat.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Pablo Neira - Oct. 15, 2012, 9:14 p.m.
On Mon, Oct 15, 2012 at 04:14:48PM +0530, Elison Niven wrote:
> Correct hooks for SNAT and DNAT targets in xt_nat.c :
> SNAT hooks should be POST_ROUTING and LOCAL_IN.
> DNAT hooks should be PRE_ROUTING and LOCAL_OUT.

Good catch. Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/xt_nat.c b/net/netfilter/xt_nat.c
index 81aafa8..bea7464 100644
--- a/net/netfilter/xt_nat.c
+++ b/net/netfilter/xt_nat.c
@@ -111,7 +111,7 @@  static struct xt_target xt_nat_target_reg[] __read_mostly = {
 		.family		= NFPROTO_IPV4,
 		.table		= "nat",
 		.hooks		= (1 << NF_INET_POST_ROUTING) |
-				  (1 << NF_INET_LOCAL_OUT),
+				  (1 << NF_INET_LOCAL_IN),
 		.me		= THIS_MODULE,
 	},
 	{
@@ -123,7 +123,7 @@  static struct xt_target xt_nat_target_reg[] __read_mostly = {
 		.family		= NFPROTO_IPV4,
 		.table		= "nat",
 		.hooks		= (1 << NF_INET_PRE_ROUTING) |
-				  (1 << NF_INET_LOCAL_IN),
+				  (1 << NF_INET_LOCAL_OUT),
 		.me		= THIS_MODULE,
 	},
 	{
@@ -133,7 +133,7 @@  static struct xt_target xt_nat_target_reg[] __read_mostly = {
 		.targetsize	= sizeof(struct nf_nat_range),
 		.table		= "nat",
 		.hooks		= (1 << NF_INET_POST_ROUTING) |
-				  (1 << NF_INET_LOCAL_OUT),
+				  (1 << NF_INET_LOCAL_IN),
 		.me		= THIS_MODULE,
 	},
 	{
@@ -143,7 +143,7 @@  static struct xt_target xt_nat_target_reg[] __read_mostly = {
 		.targetsize	= sizeof(struct nf_nat_range),
 		.table		= "nat",
 		.hooks		= (1 << NF_INET_PRE_ROUTING) |
-				  (1 << NF_INET_LOCAL_IN),
+				  (1 << NF_INET_LOCAL_OUT),
 		.me		= THIS_MODULE,
 	},
 };