Indent code properly for neatness.
This commit is contained in:
@@ -18,11 +18,10 @@
|
|||||||
#include "xdpfw.h"
|
#include "xdpfw.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define bpf_printk(fmt, ...) \
|
#define bpf_printk(fmt, ...) \
|
||||||
({ \
|
({ \
|
||||||
char ____fmt[] = fmt; \
|
char ____fmt[] = fmt; \
|
||||||
bpf_trace_printk(____fmt, sizeof(____fmt), \
|
bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \
|
||||||
##__VA_ARGS__); \
|
|
||||||
})
|
})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -32,56 +31,56 @@
|
|||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(priority, 10);
|
__uint(priority, 10);
|
||||||
__uint(XDP_PASS, 1);
|
__uint(XDP_PASS, 1);
|
||||||
} XDP_RUN_CONFIG(xdp_prog_main);
|
} XDP_RUN_CONFIG(xdp_prog_main);
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(type, BPF_MAP_TYPE_ARRAY);
|
__uint(type, BPF_MAP_TYPE_ARRAY);
|
||||||
__uint(max_entries, MAX_FILTERS);
|
__uint(max_entries, MAX_FILTERS);
|
||||||
__type(key, __u32);
|
__type(key, __u32);
|
||||||
__type(value, struct filter);
|
__type(value, struct filter);
|
||||||
} filters_map SEC(".maps");
|
} filters_map SEC(".maps");
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
|
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
|
||||||
__uint(max_entries, 1);
|
__uint(max_entries, 1);
|
||||||
__type(key, __u32);
|
__type(key, __u32);
|
||||||
__type(value, struct stats);
|
__type(value, struct stats);
|
||||||
} stats_map SEC(".maps");
|
} stats_map SEC(".maps");
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||||
__uint(max_entries, MAX_TRACK_IPS);
|
__uint(max_entries, MAX_TRACK_IPS);
|
||||||
__type(key, __u32);
|
__type(key, __u32);
|
||||||
__type(value, struct ip_stats);
|
__type(value, struct ip_stats);
|
||||||
} ip_stats_map SEC(".maps");
|
} ip_stats_map SEC(".maps");
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||||
__uint(max_entries, MAX_TRACK_IPS);
|
__uint(max_entries, MAX_TRACK_IPS);
|
||||||
__type(key, __u32);
|
__type(key, __u32);
|
||||||
__type(value, __u64);
|
__type(value, __u64);
|
||||||
} ip_blacklist_map SEC(".maps");
|
} ip_blacklist_map SEC(".maps");
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||||
__uint(max_entries, MAX_TRACK_IPS);
|
__uint(max_entries, MAX_TRACK_IPS);
|
||||||
__type(key, __u128);
|
__type(key, __u128);
|
||||||
__type(value, struct ip_stats);
|
__type(value, struct ip_stats);
|
||||||
} ip6_stats_map SEC(".maps");
|
} ip6_stats_map SEC(".maps");
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||||
__uint(max_entries, MAX_TRACK_IPS);
|
__uint(max_entries, MAX_TRACK_IPS);
|
||||||
__type(key, __u128);
|
__type(key, __u128);
|
||||||
__type(value, __u64);
|
__type(value, __u64);
|
||||||
} ip6_blacklist_map SEC(".maps");
|
} ip6_blacklist_map SEC(".maps");
|
||||||
|
|
||||||
SEC("xdp_prog")
|
SEC("xdp_prog")
|
||||||
|
|||||||
Reference in New Issue
Block a user