Skip to content

Commit

Permalink
pin ebpf map
Browse files Browse the repository at this point in the history
pin map so when xdp-loader load
then unload, and load again, the
same map can be reused.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
  • Loading branch information
vincentmli committed Sep 3, 2024
1 parent ad3bc83 commit 6c972a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xdp-dnsrrl/xdp_dnsrrl.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ struct {
__type(key, __u32);
__type(value, struct bucket_time);
__uint(max_entries, RRL_SIZE);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} state_map __section(".maps");

struct {
__uint(type, BPF_MAP_TYPE_PERCPU_HASH);
__type(key, sizeof(struct in6_addr));
__type(value, struct bucket_time);
__uint(max_entries, RRL_SIZE);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} state_map_v6 __section(".maps");


Expand Down
2 changes: 2 additions & 0 deletions xdp-synproxy/xdp_synproxy.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ struct {
__type(key, __u32);
__type(value, __u64);
__uint(max_entries, 2);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} values SEC(".maps");

struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__type(key, __u32);
__type(value, __u16);
__uint(max_entries, MAX_ALLOWED_PORTS);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} allowed_ports SEC(".maps");

/* Some symbols defined in net/netfilter/nf_conntrack_bpf.c are unavailable in
Expand Down
2 changes: 2 additions & 0 deletions xdp-udp/xdp_udp.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct {
__type(key, __u32);
__type(value, __u16);
__uint(max_entries, MAX_ALLOWED_PORTS);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} udp_ports SEC(".maps");


Expand All @@ -88,6 +89,7 @@ struct {
__type(key, __u32);
__type(value, struct bucket_time);
__uint(max_entries, RRL_SIZE);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} udp_state_map __section(".maps");

/** Copied from the kernel module of the base03-map-counter example of the
Expand Down

0 comments on commit 6c972a1

Please sign in to comment.