Linux Audio

Check our new training course

Loading...
v6.13.7
 1#include <linux/bpf.h>
 2#include <bpf/bpf_helpers.h>
 3#include <bpf/bpf_endian.h>
 4
 5struct {
 6	__uint(type, BPF_MAP_TYPE_SOCKMAP);
 7	__uint(max_entries, 20);
 8	__type(key, int);
 9	__type(value, int);
10} sock_map_rx SEC(".maps");
11
12struct {
13	__uint(type, BPF_MAP_TYPE_SOCKMAP);
14	__uint(max_entries, 20);
15	__type(key, int);
16	__type(value, int);
17} sock_map_tx SEC(".maps");
18
19struct {
20	__uint(type, BPF_MAP_TYPE_SOCKMAP);
21	__uint(max_entries, 20);
22	__type(key, int);
23	__type(value, int);
24} sock_map_msg SEC(".maps");
25
26SEC("sk_skb")
27int prog_skb_verdict(struct __sk_buff *skb)
28{
29	return SK_DROP;
30}
31
32char _license[] SEC("license") = "GPL";
v6.8
 1#include <linux/bpf.h>
 2#include <bpf/bpf_helpers.h>
 3#include <bpf/bpf_endian.h>
 4
 5struct {
 6	__uint(type, BPF_MAP_TYPE_SOCKMAP);
 7	__uint(max_entries, 20);
 8	__type(key, int);
 9	__type(value, int);
10} sock_map_rx SEC(".maps");
11
12struct {
13	__uint(type, BPF_MAP_TYPE_SOCKMAP);
14	__uint(max_entries, 20);
15	__type(key, int);
16	__type(value, int);
17} sock_map_tx SEC(".maps");
18
19struct {
20	__uint(type, BPF_MAP_TYPE_SOCKMAP);
21	__uint(max_entries, 20);
22	__type(key, int);
23	__type(value, int);
24} sock_map_msg SEC(".maps");
25
26SEC("sk_skb")
27int prog_skb_verdict(struct __sk_buff *skb)
28{
29	return SK_DROP;
30}
31
32char _license[] SEC("license") = "GPL";