act_nat: get the position info from skb->tc_verd
Subsystems (3)
PATCH 1/1 act_nat: get the position info from skb->tc_verd
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.
----
include/net/tc_act/tc_nat.h | 2 +- net/sched/act_nat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/tc_act/tc_nat.h +1 -1
@@ -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)
net/sched/act_nat.c +1 -1
@@ -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);
Herbert Xu
NAKQuoted 5 lines · Changli Gao
act_natuses its flags field to determine where it acts. It isn't reliable, and can't prevent users from doing wrong settings, andact_natshould get the position info fromskb->tc_verdasact_mirreddoes.Signed-off-by Changli Gao <[email protected]>
Nack, the direction controls whether we NAT saddr or daddr. It's perfectly OK for someone to NAT daddr on the way out.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 10 lines · Herbert Xu
Quoted 5 lines · Changli Gao
act_natuses its flags field to determine where it acts. It isn't reliable, and can't prevent users from doing wrong settings, andact_natshould get the position info fromskb->tc_verdasact_mirreddoes.Signed-off-by Changli Gao <[email protected]>Nack, the direction controls whether we NAT saddr or daddr. It's perfectly OK for someone to NAT daddr on the way out.
Thanks for your explanation. However, ingress and egress aren't as comprehensive as DNAT and SNAT. BTW I am planning to add stateless PAT(Port Address Translation) support into act_nat. Any comment?
Signature · 2 lines
Regards, Changli Gao([email protected])