diff --git a/bpf_progs/bpf_net_helpers.h b/bpf_progs/bpf_net_helpers.h index b7ca3af245..ed33cc938c 100644 --- a/bpf_progs/bpf_net_helpers.h +++ b/bpf_progs/bpf_net_helpers.h @@ -86,3 +86,30 @@ static inline __always_inline void try_make_writable(struct __sk_buff* skb, int if (len > skb->len) len = skb->len; if (skb->data_end - skb->data < len) bpf_skb_pull_data(skb, len); } + +// constants for passing in to 'bool egress' +static const bool INGRESS = false; +static const bool EGRESS = true; + +// constants for passing in to 'bool downstream' +static const bool UPSTREAM = false; +static const bool DOWNSTREAM = true; + +// constants for passing in to 'bool is_ethernet' +static const bool RAWIP = false; +static const bool ETHER = true; + +// constants for passing in to 'bool updatetime' +static const bool NO_UPDATETIME = false; +static const bool UPDATETIME = true; + +// constants for passing in to ignore_on_eng / ignore_on_user / ignore_on_userdebug +// define's instead of static const due to tm-mainline-prod compiler static_assert limitations +#define LOAD_ON_ENG false +#define LOAD_ON_USER false +#define LOAD_ON_USERDEBUG false +#define IGNORE_ON_ENG true +#define IGNORE_ON_USER true +#define IGNORE_ON_USERDEBUG true + +#define KVER_4_14 KVER(4, 14, 0) diff --git a/bpf_progs/clatd.c b/bpf_progs/clatd.c index 7c6811ab33..f05b93e428 100644 --- a/bpf_progs/clatd.c +++ b/bpf_progs/clatd.c @@ -52,12 +52,6 @@ struct frag_hdr { __be32 identification; }; -// constants for passing in to 'bool is_ethernet' -static const bool RAWIP = false; -static const bool ETHER = true; - -#define KVER_4_14 KVER(4, 14, 0) - DEFINE_BPF_MAP_GRW(clat_ingress6_map, HASH, ClatIngress6Key, ClatIngress6Value, 16, AID_SYSTEM) static inline __always_inline int nat64(struct __sk_buff* skb, diff --git a/bpf_progs/netd.c b/bpf_progs/netd.c index 6d70137778..e66cd5ac4d 100644 --- a/bpf_progs/netd.c +++ b/bpf_progs/netd.c @@ -42,10 +42,6 @@ static const int DROP_UNLESS_DNS = 2; // internal to our program static const int BPF_NOMATCH = 0; static const int BPF_MATCH = 1; -// Used for 'bool egress' -static const bool INGRESS = false; -static const bool EGRESS = true; - // Used for 'bool enable_tracing' static const bool TRACE_ON = true; static const bool TRACE_OFF = false;