File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
tools/testing/selftests/bpf Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -26,15 +26,23 @@ int rx(struct xdp_md *ctx)
26
26
{
27
27
void * data , * data_meta , * data_end ;
28
28
struct ipv6hdr * ip6h = NULL ;
29
- struct ethhdr * eth = NULL ;
30
29
struct udphdr * udp = NULL ;
31
30
struct iphdr * iph = NULL ;
32
31
struct xdp_meta * meta ;
32
+ struct ethhdr * eth ;
33
33
int err ;
34
34
35
35
data = (void * )(long )ctx -> data ;
36
36
data_end = (void * )(long )ctx -> data_end ;
37
37
eth = data ;
38
+
39
+ if (eth + 1 < data_end && (eth -> h_proto == bpf_htons (ETH_P_8021AD ) ||
40
+ eth -> h_proto == bpf_htons (ETH_P_8021Q )))
41
+ eth = (void * )eth + sizeof (struct vlan_hdr );
42
+
43
+ if (eth + 1 < data_end && eth -> h_proto == bpf_htons (ETH_P_8021Q ))
44
+ eth = (void * )eth + sizeof (struct vlan_hdr );
45
+
38
46
if (eth + 1 < data_end ) {
39
47
if (eth -> h_proto == bpf_htons (ETH_P_IP )) {
40
48
iph = (void * )(eth + 1 );
Original file line number Diff line number Diff line change 9
9
#define ETH_P_IPV6 0x86DD
10
10
#endif
11
11
12
+ #ifndef ETH_P_8021Q
13
+ #define ETH_P_8021Q 0x8100
14
+ #endif
15
+
16
+ #ifndef ETH_P_8021AD
17
+ #define ETH_P_8021AD 0x88A8
18
+ #endif
19
+
12
20
struct xdp_meta {
13
21
__u64 rx_timestamp ;
14
22
__u64 xdp_timestamp ;
You can’t perform that action at this time.
0 commit comments