From c27398ecec6b8e7a4dd2200b3ddad2e25f32a22e Mon Sep 17 00:00:00 2001 From: Christian Deacon Date: Mon, 19 Jun 2023 19:11:42 +0000 Subject: [PATCH] Indent code properly for neatness. --- src/xdpfw_kern.c | 61 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/src/xdpfw_kern.c b/src/xdpfw_kern.c index 538d972..19a7458 100644 --- a/src/xdpfw_kern.c +++ b/src/xdpfw_kern.c @@ -18,11 +18,10 @@ #include "xdpfw.h" #ifdef DEBUG -#define bpf_printk(fmt, ...) \ -({ \ - char ____fmt[] = fmt; \ - bpf_trace_printk(____fmt, sizeof(____fmt), \ - ##__VA_ARGS__); \ +#define bpf_printk(fmt, ...) \ +({ \ + char ____fmt[] = fmt; \ + bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \ }) #endif @@ -32,56 +31,56 @@ struct { - __uint(priority, 10); - __uint(XDP_PASS, 1); + __uint(priority, 10); + __uint(XDP_PASS, 1); } XDP_RUN_CONFIG(xdp_prog_main); struct { - __uint(type, BPF_MAP_TYPE_ARRAY); - __uint(max_entries, MAX_FILTERS); - __type(key, __u32); - __type(value, struct filter); + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, MAX_FILTERS); + __type(key, __u32); + __type(value, struct filter); } filters_map SEC(".maps"); struct { - __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); - __uint(max_entries, 1); - __type(key, __u32); - __type(value, struct stats); + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, 1); + __type(key, __u32); + __type(value, struct stats); } stats_map SEC(".maps"); struct { - __uint(type, BPF_MAP_TYPE_LRU_HASH); - __uint(max_entries, MAX_TRACK_IPS); - __type(key, __u32); - __type(value, struct ip_stats); + __uint(type, BPF_MAP_TYPE_LRU_HASH); + __uint(max_entries, MAX_TRACK_IPS); + __type(key, __u32); + __type(value, struct ip_stats); } ip_stats_map SEC(".maps"); struct { - __uint(type, BPF_MAP_TYPE_LRU_HASH); - __uint(max_entries, MAX_TRACK_IPS); - __type(key, __u32); - __type(value, __u64); + __uint(type, BPF_MAP_TYPE_LRU_HASH); + __uint(max_entries, MAX_TRACK_IPS); + __type(key, __u32); + __type(value, __u64); } ip_blacklist_map SEC(".maps"); struct { - __uint(type, BPF_MAP_TYPE_LRU_HASH); - __uint(max_entries, MAX_TRACK_IPS); - __type(key, __u128); - __type(value, struct ip_stats); + __uint(type, BPF_MAP_TYPE_LRU_HASH); + __uint(max_entries, MAX_TRACK_IPS); + __type(key, __u128); + __type(value, struct ip_stats); } ip6_stats_map SEC(".maps"); struct { - __uint(type, BPF_MAP_TYPE_LRU_HASH); - __uint(max_entries, MAX_TRACK_IPS); - __type(key, __u128); - __type(value, __u64); + __uint(type, BPF_MAP_TYPE_LRU_HASH); + __uint(max_entries, MAX_TRACK_IPS); + __type(key, __u128); + __type(value, __u64); } ip6_blacklist_map SEC(".maps"); SEC("xdp_prog")