net/sched: act_ct: add nat mangle action only for NAT-conntrack
Subsystems (3)
PATCH v2 1/1 net/sched: act_ct: add nat mangle action only for NAT-conntrack
From: wenxu <[email protected]>
Currently add nat mangle action with comparing invert and ori 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]>
--- net/sched/act_ct.c | 3 +++ 1 file changed, 3 insertions(+)
net/sched/act_ct.c +3 -0
@@ -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) {
Signature · 1 line
1.8.3.1
Quoted 3 lines · On Sat, May 30, 2020 at 01:54:51PM +0800, [email protected] wrote:
From: wenxu <[email protected]>
Currently add nat mangle action with comparing invert and ori tuple.
Nit, "orig" ---^
Quoted 4 lines
It is better to check
IPS_NAT_MASKflags first to avoid non necessary memcmp for non-NAT conntrack.Signed-off-by wenxu <[email protected]>
Quoted 21 lines
--- net/sched/act_ct.c | 3 +++ 1 file changed, 3 insertions(+)net/sched/act_ct.c +3
-0@@ -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) {Signature · 1 line
1.8.3.1
From: [email protected]
Date: Sat, 30 May 2020 13:54:51 +0800
Quoted 7 lines
From: wenxu <[email protected]>
Currently add nat mangle action with comparing invert and ori tuple. It is better to check
IPS_NAT_MASKflags first to avoid non necessary memcmp for non-NAT conntrack.Signed-off-by wenxu <[email protected]>
Applied.