Split logging logic from XDP program into its own files.
This commit is contained in:
13
src/xdp/utils/logging.h
Normal file
13
src/xdp/utils/logging.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <common/all.h>
|
||||
|
||||
#include <linux/bpf.h>
|
||||
|
||||
#include <xdp/xdp_helpers.h>
|
||||
#include <xdp/prog_dispatcher.h>
|
||||
|
||||
static __always_inline int LogFilterMsg(struct iphdr* iph, struct ipv6hdr* iph6, u16 src_port, u16 dst_port, u8 protocol, u64 now, u64 pps, u64 bps, int filter_id);
|
||||
|
||||
// The source file is included directly below instead of compiled and linked as an object because when linking, there is no guarantee the compiler will inline the function (which is crucial for performance).
|
||||
// I'd prefer not to include the function logic inside of the header file.
|
||||
// More Info: https://stackoverflow.com/questions/24289599/always-inline-does-not-work-when-function-is-implemented-in-different-file
|
||||
#include "logging.c"
|
||||
Reference in New Issue
Block a user