Skip to content

Commit

Permalink
net/sched: act_ct: add nat mangle action only for NAT-conntrack
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
wenxu authored and davem330 committed May 31, 2020
1 parent 1b49cd7 commit 05aa69e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/sched/act_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 05aa69e

Please sign in to comment.