xdp: fix vlan byte order

Change the byte order of vlan TCI when extracting it
from vlan_hdr in xdp_filter.c. This fixes xdp bypass for vlan tagged
packets, as without the fix flows that are supposed to be bypassed by
the xdp filter are not bypassed.

Ticket: 8699
pull/16497/head
Adam Kiripolsky 4 months ago committed by Victor Julien
parent 9ab8fa19d2
commit 5cb7a0d7be

@ -523,7 +523,7 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx)
return XDP_PASS; return XDP_PASS;
h_proto = vhdr->h_vlan_encapsulated_proto; h_proto = vhdr->h_vlan_encapsulated_proto;
#if VLAN_TRACKING #if VLAN_TRACKING
vlan0 = vhdr->h_vlan_TCI & 0x0fff; vlan0 = __constant_ntohs(vhdr->h_vlan_TCI) & 0x0fff;
#else #else
vlan0 = 0; vlan0 = 0;
#endif #endif
@ -537,7 +537,7 @@ int SEC("xdp") xdp_hashfilter(struct xdp_md *ctx)
return XDP_PASS; return XDP_PASS;
h_proto = vhdr->h_vlan_encapsulated_proto; h_proto = vhdr->h_vlan_encapsulated_proto;
#if VLAN_TRACKING #if VLAN_TRACKING
vlan1 = vhdr->h_vlan_TCI & 0x0fff; vlan1 = __constant_ntohs(vhdr->h_vlan_TCI) & 0x0fff;
#else #else
vlan1 = 0; vlan1 = 0;
#endif #endif

Loading…
Cancel
Save