Skip to content

Commit 05aa69e

Browse files
wenxudavem330
authored andcommitted
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 <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1b49cd7 commit 05aa69e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sched/act_ct.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net,
199199
const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
200200
struct nf_conntrack_tuple target;
201201

202+
if (!(ct->status & IPS_NAT_MASK))
203+
return 0;
204+
202205
nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple);
203206

204207
switch (tuple->src.l3num) {

0 commit comments

Comments
 (0)