Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: dropreason: add MACVLAN_BROADCAST_BACKLOG and IPVLAN_MULTICAST_BACKLOG

ipvlan and macvlan use queues to process broadcast/multicast packets
from a work queue.

Under attack these queues can drop packets.

Add MACVLAN_BROADCAST_BACKLOG drop_reason for macvlan broadcast queue.

Add IPVLAN_MULTICAST_BACKLOG drop_reason for ipvlan multicast queue.

Use different reasons as some deployments use both ipvlan and macvlan.

Also change ipvlan_rcv_frame() to use SKB_DROP_REASON_DEV_READY
when the device is not UP.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260407150710.1640747-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
202ab599 ea25e03d

+15 -3
+2 -2
drivers/net/ipvlan/ipvlan_core.c
··· 337 337 */ 338 338 if (local) { 339 339 if (unlikely(!(dev->flags & IFF_UP))) { 340 - kfree_skb(skb); 340 + kfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY); 341 341 goto out; 342 342 } 343 343 ··· 596 596 } else { 597 597 spin_unlock(&port->backlog.lock); 598 598 dev_core_stats_rx_dropped_inc(skb->dev); 599 - kfree_skb(skb); 599 + kfree_skb_reason(skb, SKB_DROP_REASON_IPVLAN_MULTICAST_BACKLOG); 600 600 } 601 601 } 602 602
+1 -1
drivers/net/macvlan.c
··· 386 386 return; 387 387 388 388 free_nskb: 389 - kfree_skb(nskb); 389 + kfree_skb_reason(nskb, SKB_DROP_REASON_MACVLAN_BROADCAST_BACKLOG); 390 390 err: 391 391 dev_core_stats_rx_dropped_inc(skb->dev); 392 392 }
+12
include/net/dropreason-core.h
··· 69 69 FN(QDISC_DROP) \ 70 70 FN(QDISC_BURST_DROP) \ 71 71 FN(CPU_BACKLOG) \ 72 + FN(MACVLAN_BROADCAST_BACKLOG) \ 73 + FN(IPVLAN_MULTICAST_BACKLOG) \ 72 74 FN(XDP) \ 73 75 FN(TC_INGRESS) \ 74 76 FN(UNHANDLED_PROTO) \ ··· 385 383 * netdev_max_backlog in net.rst) or RPS flow limit 386 384 */ 387 385 SKB_DROP_REASON_CPU_BACKLOG, 386 + /** 387 + * @SKB_DROP_REASON_MACVLAN_BROADCAST_BACKLOG: failed to enqueue the skb 388 + * to macvlan broadcast queue. 389 + */ 390 + SKB_DROP_REASON_MACVLAN_BROADCAST_BACKLOG, 391 + /** 392 + * @SKB_DROP_REASON_IPVLAN_MULTICAST_BACKLOG: failed to enqueue the skb 393 + * to ipvlan multicast queue. 394 + */ 395 + SKB_DROP_REASON_IPVLAN_MULTICAST_BACKLOG, 388 396 /** @SKB_DROP_REASON_XDP: dropped by XDP in input path */ 389 397 SKB_DROP_REASON_XDP, 390 398 /** @SKB_DROP_REASON_TC_INGRESS: dropped in TC ingress HOOK */