mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 01:22:07 +00:00
net/sched: act_ct: add nat mangle action only for NAT-conntrack
Currently add nat mangle action with comparing invert and orig tuple. It is better to check IPS_NAT_MASK flags first to avoid non necessary memcmp for non-NAT conntrack. Signed-off-by: wenxu <wenxu@ucloud.cn> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1b49cd71b5
commit
05aa69e5cb
@ -199,6 +199,9 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net,
|
||||
const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
|
||||
struct nf_conntrack_tuple target;
|
||||
|
||||
if (!(ct->status & IPS_NAT_MASK))
|
||||
return 0;
|
||||
|
||||
nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple);
|
||||
|
||||
switch (tuple->src.l3num) {
|
||||
|
Loading…
Reference in New Issue
Block a user