Commit 05aa69e5 authored by wenxu's avatar wenxu Committed by David S. Miller

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: default avatarwenxu <wenxu@ucloud.cn>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b49cd71
...@@ -199,6 +199,9 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net, ...@@ -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; const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
struct nf_conntrack_tuple target; struct nf_conntrack_tuple target;
if (!(ct->status & IPS_NAT_MASK))
return 0;
nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple); nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple);
switch (tuple->src.l3num) { switch (tuple->src.l3num) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment