netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>,
	davem@davemloft.net, kuba@kernel.org
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Davide Caratti <dcaratti@redhat.com>,
	Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH net 2/2] net: sched: also drop dst for the packets toward ingress in act_mirred
Date: Mon, 20 Sep 2021 06:19:22 -0400	[thread overview]
Message-ID: <a1253d4c38990854e5369074e4cbc9cd2098c532.1632133123.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <cover.1632133123.git.lucien.xin@gmail.com>

Without dropping dst, the packets sent from local mirred/redirected
to ingress will may still use the old dst. ip_rcv() will drop it as
the old dst is for output and its .input is dst_discard.

This patch is to fix by also dropping dst for those packets that are
mirred or redirected to ingress in act_mirred.

Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sched/act_mirred.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 46dff1f1e7c8..5e30b3e64b63 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -19,6 +19,7 @@
 #include <linux/if_arp.h>
 #include <net/net_namespace.h>
 #include <net/netlink.h>
+#include <net/dst.h>
 #include <net/pkt_sched.h>
 #include <net/pkt_cls.h>
 #include <linux/tc_act/tc_mirred.h>
@@ -209,6 +210,7 @@ static int tcf_mirred_forward(bool want_ingress, struct sk_buff *skb)
 		return tcf_dev_queue_xmit(skb, dev_queue_xmit);
 
 	nf_reset_ct(skb);
+	skb_dst_drop(skb);
 
 	return netif_receive_skb(skb);
 }
-- 
2.27.0


  parent reply	other threads:[~2021-09-20 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 10:19 [PATCH net 0/2] net: sched: drop ct and dst for the packets toward ingress in act_mirred Xin Long
2021-09-20 10:19 ` [PATCH net 1/2] net: sched: drop ct for the packets toward ingress only " Xin Long
2021-09-20 18:31   ` Cong Wang
2021-09-21  7:01     ` Xin Long
2021-09-22  3:43       ` Cong Wang
2021-09-22  5:17         ` Xin Long
2021-09-24 23:04           ` mleitner
2021-09-20 10:19 ` Xin Long [this message]
2021-09-20 18:34   ` [PATCH net 2/2] net: sched: also drop dst for the packets toward ingress " Cong Wang
2021-09-21  7:01     ` Xin Long
2021-09-22  3:52       ` Cong Wang
2021-09-22  5:29         ` Xin Long
2021-09-23 16:06         ` Jamal Hadi Salim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1253d4c38990854e5369074e4cbc9cd2098c532.1632133123.git.lucien.xin@gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=kuba@kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).