diff options
author | Daniel T. Lee <danieltimlee@gmail.com> | 2023-01-15 16:16:11 +0900 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-01-15 13:32:45 -0800 |
commit | c2f4f5593e6ae8014b277b46f5f9a8227f11d69c (patch) | |
tree | b0783fde4891a16ecaae27c6e6f3a561bdb234bb /samples/bpf/net_shared.h | |
parent | e69fe8459552f112d7327dff87953d40202c61f1 (diff) | |
download | linux-c2f4f5593e6ae8014b277b46f5f9a8227f11d69c.tar.gz linux-c2f4f5593e6ae8014b277b46f5f9a8227f11d69c.tar.bz2 linux-c2f4f5593e6ae8014b277b46f5f9a8227f11d69c.zip |
samples/bpf: replace BPF programs header with net_shared.h
This commit applies "net_shared.h" to BPF programs to remove existing
network related header dependencies. Also, this commit removes
unnecessary headers before applying "vmlinux.h" to the BPF programs.
Mostly, endianness conversion function has been applied to the source.
In addition, several macros have been defined to fulfill the INET,
TC-related constants.
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Link: https://lore.kernel.org/r/20230115071613.125791-9-danieltimlee@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'samples/bpf/net_shared.h')
-rw-r--r-- | samples/bpf/net_shared.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/samples/bpf/net_shared.h b/samples/bpf/net_shared.h index 04b29b217d25..e9429af9aa44 100644 --- a/samples/bpf/net_shared.h +++ b/samples/bpf/net_shared.h @@ -2,6 +2,9 @@ #ifndef _NET_SHARED_H #define _NET_SHARED_H +#define AF_INET 2 +#define AF_INET6 10 + #define ETH_ALEN 6 #define ETH_P_802_3_MIN 0x0600 #define ETH_P_8021Q 0x8100 @@ -11,6 +14,9 @@ #define ETH_P_ARP 0x0806 #define IPPROTO_ICMPV6 58 +#define TC_ACT_OK 0 +#define TC_ACT_SHOT 2 + #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define bpf_ntohs(x) __builtin_bswap16(x) |