* [PATCH v2] net/sched: act_ct: add nat mangle action only for NAT-conntrack
@ 2020-05-30 5:54 wenxu
2020-05-30 12:21 ` Marcelo Ricardo Leitner
2020-05-31 0:58 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: wenxu @ 2020-05-30 5:54 UTC (permalink / raw)
To: paulb, marcelo.leitner; +Cc: netdev
From: wenxu <wenxu@ucloud.cn>
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 <wenxu@ucloud.cn>
---
net/sched/act_ct.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index 1a76639..2057735 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -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) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] net/sched: act_ct: add nat mangle action only for NAT-conntrack
2020-05-30 5:54 [PATCH v2] net/sched: act_ct: add nat mangle action only for NAT-conntrack wenxu
@ 2020-05-30 12:21 ` Marcelo Ricardo Leitner
2020-05-31 0:58 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2020-05-30 12:21 UTC (permalink / raw)
To: wenxu; +Cc: paulb, netdev
On Sat, May 30, 2020 at 01:54:51PM +0800, wenxu@ucloud.cn wrote:
> From: wenxu <wenxu@ucloud.cn>
>
> Currently add nat mangle action with comparing invert and ori tuple.
Nit, "orig" ---^
> 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>
> ---
> net/sched/act_ct.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
> index 1a76639..2057735 100644
> --- a/net/sched/act_ct.c
> +++ b/net/sched/act_ct.c
> @@ -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) {
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] net/sched: act_ct: add nat mangle action only for NAT-conntrack
2020-05-30 5:54 [PATCH v2] net/sched: act_ct: add nat mangle action only for NAT-conntrack wenxu
2020-05-30 12:21 ` Marcelo Ricardo Leitner
@ 2020-05-31 0:58 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-05-31 0:58 UTC (permalink / raw)
To: wenxu; +Cc: paulb, marcelo.leitner, netdev
From: wenxu@ucloud.cn
Date: Sat, 30 May 2020 13:54:51 +0800
> From: wenxu <wenxu@ucloud.cn>
>
> 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 <wenxu@ucloud.cn>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-31 0:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-30 5:54 [PATCH v2] net/sched: act_ct: add nat mangle action only for NAT-conntrack wenxu
2020-05-30 12:21 ` Marcelo Ricardo Leitner
2020-05-31 0:58 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox