vxlan: rename the drop reasons for use by other tunnels

VXLAN_INVALID_HDR and VXLAN_VNI_NOT_FOUND describe conditions that are
not specific to vxlan: a malformed tunnel header, and a packet for
which no tunnel device is found. The GRE receive paths drop packets
for the same two conditions, and can report them with the same reasons
once they are converted to drop reasons.

Rename them to TUNNEL_INVALID_HDR and TUNNEL_NOT_FOUND and reword their
descriptions, the way VXLAN_NO_REMOTE became NO_TX_TARGET in commit
46e0ccfb88 ("net: vxlan: rename SKB_DROP_REASON_VXLAN_NO_REMOTE").
The numeric values stay the same; the names that the skb:kfree_skb
tracepoint and drop_monitor report change.

Suggested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261005201417.906344-2-littlesmilingcloud@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Anton Danilov 2026-10-05 23:14:14 +03:00 committed by Jakub Kicinski
parent 8df0638138
commit 7629d6db83
2 changed files with 15 additions and 12 deletions

View File

@ -1700,7 +1700,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
if (!(vh->vx_flags & VXLAN_HF_VNI)) {
netdev_dbg(skb->dev, "invalid vxlan flags=%#x vni=%#x\n",
ntohl(vh->vx_flags), ntohl(vh->vx_vni));
reason = SKB_DROP_REASON_VXLAN_INVALID_HDR;
reason = SKB_DROP_REASON_TUNNEL_INVALID_HDR;
/* Return non vxlan pkt */
goto drop;
}
@ -1713,7 +1713,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
vxlan = vxlan_vs_find_vni(vs, skb->dev->ifindex, vni, &vninode);
if (!vxlan) {
reason = SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND;
reason = SKB_DROP_REASON_TUNNEL_NOT_FOUND;
goto drop;
}
@ -1729,7 +1729,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
* previous stack code, and also is more robust and provides a
* little more security in adding extensions to VXLAN.
*/
reason = SKB_DROP_REASON_VXLAN_INVALID_HDR;
reason = SKB_DROP_REASON_TUNNEL_INVALID_HDR;
DEV_STATS_INC(vxlan->dev, rx_frame_errors);
DEV_STATS_INC(vxlan->dev, rx_errors);
vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
@ -2383,7 +2383,7 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
DEV_STATS_INC(dev, tx_errors);
vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
VXLAN_VNI_STATS_TX_ERRORS, 0);
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND);
kfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_NOT_FOUND);
return -ENOENT;
}

View File

@ -111,8 +111,8 @@
FN(PACKET_SOCK_ERROR) \
FN(TC_CHAIN_NOTFOUND) \
FN(TC_RECLASSIFY_LOOP) \
FN(VXLAN_INVALID_HDR) \
FN(VXLAN_VNI_NOT_FOUND) \
FN(TUNNEL_INVALID_HDR) \
FN(TUNNEL_NOT_FOUND) \
FN(MAC_INVALID_SOURCE) \
FN(VXLAN_ENTRY_EXISTS) \
FN(NO_TX_TARGET) \
@ -539,13 +539,16 @@ enum skb_drop_reason {
*/
SKB_DROP_REASON_TC_RECLASSIFY_LOOP,
/**
* @SKB_DROP_REASON_VXLAN_INVALID_HDR: VXLAN header is invalid. E.g.:
* 1) reserved fields are not zero
* 2) "I" flag is not set
* @SKB_DROP_REASON_TUNNEL_INVALID_HDR: tunnel header is invalid. E.g.:
* 1) VXLAN reserved fields are not zero
* 2) VXLAN "I" flag is not set
*/
SKB_DROP_REASON_VXLAN_INVALID_HDR,
/** @SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND: no VXLAN device found for VNI */
SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND,
SKB_DROP_REASON_TUNNEL_INVALID_HDR,
/**
* @SKB_DROP_REASON_TUNNEL_NOT_FOUND: no tunnel device found for the
* packet, e.g. no VXLAN device for its VNI
*/
SKB_DROP_REASON_TUNNEL_NOT_FOUND,
/** @SKB_DROP_REASON_MAC_INVALID_SOURCE: source mac is invalid */
SKB_DROP_REASON_MAC_INVALID_SOURCE,
/**