Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.4-rc3 26 lines 516 B view raw
1#include <linux/bpf.h> 2 3#include "bpf_helpers.h" 4#include "bpf_endian.h" 5 6int _version SEC("version") = 1; 7 8SEC("sk_msg1") 9int bpf_prog1(struct sk_msg_md *msg) 10{ 11 void *data_end = (void *)(long) msg->data_end; 12 void *data = (void *)(long) msg->data; 13 14 char *d; 15 16 if (data + 8 > data_end) 17 return SK_DROP; 18 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]); 22 23 return SK_PASS; 24} 25 26char _license[] SEC("license") = "GPL";