1
2
3
4
5
6
7
8#include <linux/bpf.h>
9#include <linux/if_ether.h>
10#include "bpf_helpers.h"
11
12int _version SEC("version") = 1;
13
14SEC("xdp_adjust_tail")
15int _xdp_adjust_tail(struct xdp_md *xdp)
16{
17 void *data_end = (void *)(long)xdp->data_end;
18 void *data = (void *)(long)xdp->data;
19 int offset = 0;
20
21 if (data_end - data == 54)
22 offset = 256;
23 else
24 offset = 20;
25 if (bpf_xdp_adjust_tail(xdp, 0 - offset))
26 return XDP_DROP;
27 return XDP_TX;
28}
29
30char _license[] SEC("license") = "GPL";
31