1 #include <uapi/linux/bpf.h>
2 #include <linux/socket.h>
4 #include <uapi/linux/in.h>
5 #include <uapi/linux/in6.h>
6 #include "bpf_helpers.h"
9 int bpf_prog1(struct bpf_sock *sk)
11 char fmt[] = "socket: family %d type %d protocol %d\n";
13 bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol);
15 /* block PF_INET6, SOCK_RAW, IPPROTO_ICMPV6 sockets
16 * ie., make ping6 fail
18 if (sk->family == PF_INET6 &&
19 sk->type == SOCK_RAW &&
20 sk->protocol == IPPROTO_ICMPV6)
27 int bpf_prog2(struct bpf_sock *sk)
29 char fmt[] = "socket: family %d type %d protocol %d\n";
31 bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol);
33 /* block PF_INET, SOCK_RAW, IPPROTO_ICMP sockets
36 if (sk->family == PF_INET &&
37 sk->type == SOCK_RAW &&
38 sk->protocol == IPPROTO_ICMP)
44 char _license[] SEC("license") = "GPL";