staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / sockmap_parse_prog.c
blob9390e02442595a39ddfda628b398a91b5b78eede
1 #include <linux/bpf.h>
2 #include "bpf_helpers.h"
3 #include "bpf_endian.h"
5 int _version SEC("version") = 1;
7 SEC("sk_skb1")
8 int bpf_prog1(struct __sk_buff *skb)
10 void *data_end = (void *)(long) skb->data_end;
11 void *data = (void *)(long) skb->data;
12 __u32 lport = skb->local_port;
13 __u32 rport = skb->remote_port;
14 __u8 *d = data;
15 __u32 len = (__u32) data_end - (__u32) data;
16 int err;
18 if (data + 10 > data_end) {
19 err = bpf_skb_pull_data(skb, 10);
20 if (err)
21 return SK_DROP;
23 data_end = (void *)(long)skb->data_end;
24 data = (void *)(long)skb->data;
25 if (data + 10 > data_end)
26 return SK_DROP;
29 /* This write/read is a bit pointless but tests the verifier and
30 * strparser handler for read/write pkt data and access into sk
31 * fields.
33 d = data;
34 d[7] = 1;
35 return skb->len;
38 char _license[] SEC("license") = "GPL";