Re: [PATCH net-next v2 07/12] net: vxlan: add skb drop reasons to vxlan_rcv()
From: Alexander Lobakin
Date: Tue Sep 03 2024 - 08:33:37 EST
From: Menglong Dong <menglong8.dong@xxxxxxxxx>
Date: Sun, 1 Sep 2024 21:02:17 +0800
> On Fri, Aug 30, 2024 at 11:04 PM Alexander Lobakin
> <aleksander.lobakin@xxxxxxxxx> wrote:
[...]
>>> @@ -1814,8 +1830,9 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
>>> return 0;
>>>
>>> drop:
>>> + reason = reason ?: SKB_DROP_REASON_NOT_SPECIFIED;
>>
>> Is this possible that @reason will be 0 (NOT_DROPPED_YET) here? At the
>> beginning of the function, it's not initialized, then each error path
>> sets it to a specific value. In most paths, you check for it being != 0
>> as a sign of error, so I doubt it can be 0 here.
>>
>
> It can be 0 here, as we don't set a reason for every "goto drop"
> path. For example, in the line:
>
> if (!vs)
> goto drop;
>
> we don't set a reason, and the "reason" is 0 when we "goto drop",
> as I don't think that it is worth introducing a reason here.
Aaah okay, I didn't notice that, thanks for the explanation!
>
> Thanks!
> Menglong Dong
>
>>> /* Consume bad packet */
>>> - kfree_skb(skb);
>>> + kfree_skb_reason(skb, reason);
>>> return 0;
>>> }
Thanks,
Olek