netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] veth: Drop MTU check when forwarding packets
@ 2024-08-08  7:04 Duan Jiong
  2024-08-08  9:23 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 11+ messages in thread
From: Duan Jiong @ 2024-08-08  7:04 UTC (permalink / raw)
  To: netdev; +Cc: Duan Jiong

When the mtu of the veth card is not the same at both ends, there
is no need to check the mtu when forwarding packets, and it should
be a permissible behavior to allow receiving packets with larger
mtu than your own.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
---
 drivers/net/veth.c        | 2 +-
 include/linux/netdevice.h | 1 +
 net/core/dev.c            | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 426e68a95067..f505fe2a55c1 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -317,7 +317,7 @@ static int veth_xdp_rx(struct veth_rq *rq, struct sk_buff *skb)
 static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
 			    struct veth_rq *rq, bool xdp)
 {
-	return __dev_forward_skb(dev, skb) ?: xdp ?
+	return __dev_forward_skb_nomtu(dev, skb) ?: xdp ?
 		veth_xdp_rx(rq, skb) :
 		__netif_rx(skb);
 }
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d20c6c99eb88..8cee9b40e50e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3943,6 +3943,7 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
 u8 dev_xdp_prog_count(struct net_device *dev);
 u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode);
 
+int __dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
 int dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
diff --git a/net/core/dev.c b/net/core/dev.c
index e1bb6d7856d9..acd740f78b1c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2190,6 +2190,12 @@ static int __dev_forward_skb2(struct net_device *dev, struct sk_buff *skb,
 	return ret;
 }
 
+int __dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb)
+{
+	return __dev_forward_skb2(dev, skb, false);
+}
+EXPORT_SYMBOL_GPL(__dev_forward_skb_nomtu);
+
 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 {
 	return __dev_forward_skb2(dev, skb, true);
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-08-16 21:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08  7:04 [PATCH v3] veth: Drop MTU check when forwarding packets Duan Jiong
2024-08-08  9:23 ` Toke Høiland-Jørgensen
2024-08-08  9:55   ` Duan Jiong
2024-08-08 10:21     ` Toke Høiland-Jørgensen
     [not found]       ` <00f872ac-4f59-4857-9c50-2d87ed860d4f@Spark>
2024-08-08 12:24         ` Toke Høiland-Jørgensen
2024-08-08 19:38           ` Willem de Bruijn
2024-08-09  9:47             ` Toke Høiland-Jørgensen
2024-08-12  9:11               ` Duan Jiong
2024-08-13 11:40                 ` Toke Høiland-Jørgensen
2024-08-14  6:42                   ` Duan Jiong
2024-08-16 21:09                     ` Toke Høiland-Jørgensen

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).