Re: [PATCH net-next 08/10] net: vxlan: add drop reasons support to vxlan_xmit_one()

From: Ido Schimmel
Date: Tue Aug 20 2024 - 08:34:08 EST


On Thu, Aug 15, 2024 at 08:43:00PM +0800, Menglong Dong wrote:
> diff --git a/drivers/net/vxlan/drop.h b/drivers/net/vxlan/drop.h
> index da30cb4a9ed9..542f391b1273 100644
> --- a/drivers/net/vxlan/drop.h
> +++ b/drivers/net/vxlan/drop.h
> @@ -14,6 +14,7 @@
> R(VXLAN_DROP_MAC) \
> R(VXLAN_DROP_TXINFO) \
> R(VXLAN_DROP_REMOTE) \
> + R(VXLAN_DROP_REMOTE_IP) \
> /* deliberate comment for trailing \ */
>
> enum vxlan_drop_reason {
> diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
> index 22e2bf532ac3..c1bae120727f 100644
> --- a/drivers/net/vxlan/vxlan_core.c
> +++ b/drivers/net/vxlan/vxlan_core.c
> @@ -2375,6 +2375,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> bool xnet = !net_eq(vxlan->net, dev_net(vxlan->dev));
> bool no_eth_encap;
> __be32 vni = 0;
> + SKB_DR(reason);
>
> no_eth_encap = flags & VXLAN_F_GPE && skb->protocol != htons(ETH_P_TEB);
> if (!skb_vlan_inet_prepare(skb, no_eth_encap))
> @@ -2396,6 +2397,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> default_vni, true);
> return;
> }
> + reason = (u32)VXLAN_DROP_REMOTE_IP;

This looks quite obscure to me. I didn't know you can add 0.0.0.0 as
remote and I'm not sure what is the use case. Personally I wouldn't
bother with this reason.

> goto drop;
> }