WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / sockmap_tcp_msg_prog.c
blobfdb4bf4408fa782c6f0e91aafd500d9905b0e7f5
1 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_endian.h>
6 int _version SEC("version") = 1;
8 SEC("sk_msg1")
9 int bpf_prog1(struct sk_msg_md *msg)
11 void *data_end = (void *)(long) msg->data_end;
12 void *data = (void *)(long) msg->data;
14 char *d;
16 if (data + 8 > data_end)
17 return SK_DROP;
19 bpf_printk("data length %i\n", (__u64)msg->data_end - (__u64)msg->data);
20 d = (char *)data;
21 bpf_printk("hello sendmsg hook %i %i\n", d[0], d[1]);
23 return SK_PASS;
26 char _license[] SEC("license") = "GPL";