All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] act_nat: get the position info from skb->tc_verd
@ 2010-07-29 18:42 Changli Gao
  2010-07-30  2:36 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Changli Gao @ 2010-07-29 18:42 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, Jamal Hadi Salim, netdev, Changli Gao

act_nat uses its flags field to determine where it acts. It isn't reliable,
and can't prevent users from doing wrong settings, and act_nat should get the
position info from skb->tc_verd as act_mirred does.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 include/net/tc_act/tc_nat.h |    2 +-
 net/sched/act_nat.c         |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h
index 4a691f3..343376a 100644
--- a/include/net/tc_act/tc_nat.h
+++ b/include/net/tc_act/tc_nat.h
@@ -10,7 +10,7 @@ struct tcf_nat {
 	__be32 old_addr;
 	__be32 new_addr;
 	__be32 mask;
-	u32 flags;
+	u32 flags;	/* unused */
 };
 
 static inline struct tcf_nat *to_tcf_nat(struct tcf_common *pc)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 24e614c..144e118 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -121,7 +121,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 	old_addr = p->old_addr;
 	new_addr = p->new_addr;
 	mask = p->mask;
-	egress = p->flags & TCA_NAT_FLAG_EGRESS;
+	egress = G_TC_AT(skb->tc_verd) & AT_EGRESS;
 	action = p->tcf_action;
 
 	p->tcf_bstats.bytes += qdisc_pkt_len(skb);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-30  2:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 18:42 [PATCH] act_nat: get the position info from skb->tc_verd Changli Gao
2010-07-30  2:36 ` Herbert Xu
2010-07-30  2:57   ` Changli Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.