Thread (13 messages) flat view 13 messages, 4 authors, 2021-09-24
STALE1803d

[PATCH net 1/2] net: sched: drop ct for the packets toward ingress only in act_mirred

From: Xin Long <lucien.xin@gmail.com>
Date: 2021-09-20 10:19:31
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

nf_reset_ct() called in tcf_mirred_act() is supposed to drop ct for
those packets that are mirred or redirected to only ingress, not
ingress and egress.

This patch is to move nf_reset_ct() to tcf_mirred_forward() and to
be called only when want_ingress is true.

Fixes: d09c548dbf3b ("net: sched: act_mirred: Reset ct info when mirror")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sched/act_mirred.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index d64b0eeccbe4..46dff1f1e7c8 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -205,14 +205,12 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 
 static int tcf_mirred_forward(bool want_ingress, struct sk_buff *skb)
 {
-	int err;
-
 	if (!want_ingress)
-		err = tcf_dev_queue_xmit(skb, dev_queue_xmit);
-	else
-		err = netif_receive_skb(skb);
+		return tcf_dev_queue_xmit(skb, dev_queue_xmit);
 
-	return err;
+	nf_reset_ct(skb);
+
+	return netif_receive_skb(skb);
 }
 
 static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
@@ -271,9 +269,6 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
 			goto out;
 	}
 
-	/* All mirred/redirected skbs should clear previous ct info */
-	nf_reset_ct(skb2);
-
 	want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
 
 	expects_nh = want_ingress || !m_mac_header_xmit;
-- 
2.27.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help