Skip to content

Commit 7932010

Browse files
Ivan Morettmeta-codesync[bot]
authored andcommitted
Guard common/bpf include with __has_include for OSS build
Summary: Fixes #260. D99357415 replaced two local macro defines in katran/lib/bpf/balancer_consts.h with `#include "common/bpf/bpf_net_helpers.h"`, an internal-only fbcode header that is never exported to the public katran OSS mirror. Public clones building via build_katran.sh fail to compile balancer.bpf.c / healthchecking.bpf.c (missing-file error), but the OSS build script redirects the BPF build step's stderr to /dev/null, so the failure is silent and produces truncated 400-byte stub .bpf.o files instead of a build error. Verified (grep across katran/lib/bpf and katran/decap, all includers of balancer_consts.h) that BE_ETH_P_IP / BE_ETH_P_IPV6 are the only two symbols this public include path actually needs from bpf_net_helpers.h; other symbols it provides (ETH_ALEN, ipv6 helpers, etc.) are either unused here or resolve independently via a direct linux/if_ether.h include in the same translation units. Restoring the two defines with their original values (8 / 56710, identical to what bpf_net_helpers.h currently supplies) is a no-op for internal fbcode builds (the //common/bpf:bpf_net_helpers BUCK dep becomes unused but harmless) and fixes the public OSS build. ___ Differential Revision: D114403255 fbshipit-source-id: ed5dc48764ba8b5e0484fa6993b2f3999d01fbe6
1 parent 2c3ccb8 commit 7932010

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

katran/lib/bpf/balancer_consts.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@
2020
* This file contains definition of all balancer specific constants
2121
*/
2222

23+
#if __has_include("common/bpf/bpf_net_helpers.h")
2324
#include "common/bpf/bpf_net_helpers.h"
25+
#else
26+
// OSS build: common/bpf is internal-only and not mirrored. katran needs just
27+
// these two: we dont want to do htons for each packet, so this is ETH_P_IPV6
28+
// and ETH_P_IP in be format.
29+
#define BE_ETH_P_IP 8
30+
#define BE_ETH_P_IPV6 56710
31+
#endif
2432

2533
// GUE variant 1 using first four bits of inner packet as a pseudo header
2634
// we are using last two of this four bits to distinct v4 vs v6. see RFC for

0 commit comments

Comments
 (0)