netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2()
@ 2025-12-02 10:39 Dmitry Skorodumov
  2025-12-04 12:52 ` Paolo Abeni
  2025-12-04 13:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Skorodumov @ 2025-12-02 10:39 UTC (permalink / raw)
  To: netdev, Jakub Kicinski, Dmitry Skorodumov, Julian Vetter,
	Guillaume Nault, Eric Dumazet, Mahesh Bandewar, David S. Miller,
	linux-kernel
  Cc: Andrew Lunn, Paolo Abeni

Packets with pkt_type == PACKET_LOOPBACK are captured by
handle_frame() function, but they don't have L2 header.
We should not process them in handle_mode_l2().

This doesn't affect old L2 functionality, since handling
was anyway incorrect.

Handle them the same way as in br_handle_frame():
just pass the skb.

To observe invalid behaviour, just start "ping -b" on bcast address
of port-interface.

Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
---
 drivers/net/ipvlan/ipvlan_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index dea411e132db..2efa3ba148aa 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -737,6 +737,9 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
 	struct ethhdr *eth = eth_hdr(skb);
 	rx_handler_result_t ret = RX_HANDLER_PASS;
 
+	if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
+		return RX_HANDLER_PASS;
+
 	if (is_multicast_ether_addr(eth->h_dest)) {
 		if (ipvlan_external_frame(skb, port)) {
 			struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
-- 
2.25.1


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

* Re: [PATCH net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2()
  2025-12-02 10:39 [PATCH net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2() Dmitry Skorodumov
@ 2025-12-04 12:52 ` Paolo Abeni
  2025-12-04 13:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2025-12-04 12:52 UTC (permalink / raw)
  To: Dmitry Skorodumov, netdev, Jakub Kicinski, Julian Vetter,
	Guillaume Nault, Eric Dumazet, Mahesh Bandewar, David S. Miller,
	linux-kernel
  Cc: Andrew Lunn

On 12/2/25 11:39 AM, Dmitry Skorodumov wrote:
> Packets with pkt_type == PACKET_LOOPBACK are captured by
> handle_frame() function, but they don't have L2 header.
> We should not process them in handle_mode_l2().
> 
> This doesn't affect old L2 functionality, since handling
> was anyway incorrect.
> 
> Handle them the same way as in br_handle_frame():
> just pass the skb.
> 
> To observe invalid behaviour, just start "ping -b" on bcast address
> of port-interface.
> 
> Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
> Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>

Since you appear the have momentum on ipvlan devel, please consider
adding self-tests for the issue you are addressing.

You can later leverage the same infra for functional coverage and that
will help your intended development.

Thanks,

Paolo


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

* Re: [PATCH net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2()
  2025-12-02 10:39 [PATCH net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2() Dmitry Skorodumov
  2025-12-04 12:52 ` Paolo Abeni
@ 2025-12-04 13:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-04 13:00 UTC (permalink / raw)
  To: Dmitry Skorodumov
  Cc: netdev, kuba, julian, gnault, edumazet, maheshb, davem,
	linux-kernel, andrew+netdev, pabeni

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 2 Dec 2025 13:39:03 +0300 you wrote:
> Packets with pkt_type == PACKET_LOOPBACK are captured by
> handle_frame() function, but they don't have L2 header.
> We should not process them in handle_mode_l2().
> 
> This doesn't affect old L2 functionality, since handling
> was anyway incorrect.
> 
> [...]

Here is the summary with links:
  - [net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2()
    https://git.kernel.org/netdev/net/c/0c57ff008a11

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-12-04 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 10:39 [PATCH net] ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2() Dmitry Skorodumov
2025-12-04 12:52 ` Paolo Abeni
2025-12-04 13:00 ` patchwork-bot+netdevbpf

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