2022-02-21 03:33:27

by Menglong Dong

[permalink] [raw]
Subject: [PATCH net-next 3/3] net: neigh: add skb drop reasons to arp_error_report()

From: Menglong Dong <[email protected]>

When neighbour become invalid or destroyed, neigh_invalidate() will be
called. neigh->ops->error_report() will be called if the neighbour's
state is NUD_FAILED, and seems here is the only use of error_report().
So we can tell that the reason of skb drops in arp_error_report() is
SKB_DROP_REASON_NEIGH_FAILED.

Replace kfree_skb() used in arp_error_report() with kfree_skb_reason().

Reviewed-by: Mengen Sun <[email protected]>
Reviewed-by: Hao Peng <[email protected]>
Signed-off-by: Menglong Dong <[email protected]>
---
net/ipv4/arp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 4db0325f6e1a..8e4ca4738c43 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -293,7 +293,7 @@ static int arp_constructor(struct neighbour *neigh)
static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
{
dst_link_failure(skb);
- kfree_skb(skb);
+ kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_FAILED);
}

/* Create and send an arp packet. */
--
2.35.1


2022-02-22 05:17:23

by David Ahern

[permalink] [raw]
Subject: Re: [PATCH net-next 3/3] net: neigh: add skb drop reasons to arp_error_report()

On 2/20/22 8:57 AM, [email protected] wrote:
> From: Menglong Dong <[email protected]>
>
> When neighbour become invalid or destroyed, neigh_invalidate() will be
> called. neigh->ops->error_report() will be called if the neighbour's
> state is NUD_FAILED, and seems here is the only use of error_report().
> So we can tell that the reason of skb drops in arp_error_report() is
> SKB_DROP_REASON_NEIGH_FAILED.
>
> Replace kfree_skb() used in arp_error_report() with kfree_skb_reason().
>
> Reviewed-by: Mengen Sun <[email protected]>
> Reviewed-by: Hao Peng <[email protected]>
> Signed-off-by: Menglong Dong <[email protected]>
> ---
> net/ipv4/arp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: David Ahern <[email protected]>