Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion felix/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ GPL-licensed BPF programs compiled to eBPF bytecode with clang/LLVM.
- **NAT**: `nat.h`, `nat4.h`, `nat6.h`, `nat_types.h`, `nat_lookup.h`
- **Conntrack**: `conntrack.h`, `conntrack_types.h` — connection tracking state
- **Policy**: `policy.h`, `failsafe.h` — policy evaluation, failsafe rules
- **Routing**: `routes.h`, `fib.h`, `fib_common.h`, `fib_co_re.h`, `fib_legacy.h`
- **Routing**: `routes.h`, `fib.h`, `fib_common.h`, `fib_co_re.h`
- **Protocol**: `tcp4.h`, `tcp6.h`, `icmp.h`, `icmp4.h`, `icmp6.h`, `arp.h`
- **Load Balancing**: `jenkins_hash.h`, `maglev.h`, `ctlb.h`
- **Utilities**: `jump.h` (tail calls), `log.h`, `events.h`, `counters.h`
Expand Down
27 changes: 1 addition & 26 deletions felix/bpf-gpl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ UT_CFLAGS=\
-DCALI_LOG_LEVEL=CALI_LOG_LEVEL_DEBUG \
-DUNITTEST \
-DCALI_LOG_PFX=UNITTEST \
-DBPF_CORE_SUPPORTED \
-I .

# Mini-UT programs that test one or two functions. These are each in their own files.
Expand Down Expand Up @@ -232,63 +231,39 @@ ut/tcp_rst_v6.o: ut/tcp_rst_v6.ll
$(COMPILE)
%_debug_v4.ll: %.c %.d calculate-flags
$(COMPILE)
%_no_log_co-re_v4.ll: %.c %.d calculate-flags
$(COMPILE)
%_debug_co-re_v4.ll: %.c %.d calculate-flags
$(COMPILE)

%_v4.ll: %_v4.c %_v4.d calculate-flags
$(COMPILE)
%_no_log_v4.ll: %_v4.c %_v4.d calculate-flags
$(COMPILE)
%_debug_v4.ll: %_v4.c %_v4.d calculate-flags
$(COMPILE)
%_no_log_co-re_v4.ll: %_v4.c %_v4.d calculate-flags
$(COMPILE)
%_debug_co-re_v4.ll: %_v4.c %_v4.d calculate-flags
$(COMPILE)

%_v46.ll: %_v46.c %_v46.d calculate-flags
$(COMPILE)
%_no_log_v46.ll: %_v46.c %_v46.d calculate-flags
$(COMPILE)
%_debug_v46.ll: %_v46.c %_v46.d calculate-flags
$(COMPILE)
%_no_log_co-re_v46.ll: %_v46.c %_v46.d calculate-flags
$(COMPILE)
%_debug_co-re_v46.ll: %_v46.c %_v46.d calculate-flags
$(COMPILE)

%_v6.ll: %_v6.c %_v6.d calculate-flags
$(COMPILE)
%_no_log_v6.ll: %_v6.c %_v6.d calculate-flags
$(COMPILE)
%_debug_v6.ll: %_v6.c %_v6.d calculate-flags
$(COMPILE)
%_no_log_co-re_v6.ll: %_v6.c %_v6.d calculate-flags
$(COMPILE)
%_debug_co-re_v6.ll: %_v6.c %_v6.d calculate-flags
$(COMPILE)

%_v6.ll: %.c %_v6.d calculate-flags
$(COMPILE)
%_no_log_v6.ll: %.c %_v6.d calculate-flags
$(COMPILE)
%_debug_v6.ll: %.c %_v6.d calculate-flags
$(COMPILE)
%_no_log_co-re_v6.ll: %.c %_v6.d calculate-flags
$(COMPILE)
%_debug_co-re_v6.ll: %.c %_v6.d calculate-flags
$(COMPILE)

%_no_log.ll: %.c %.d calculate-flags
$(COMPILE)
%_debug.ll: %.c %.d calculate-flags
$(COMPILE)
%_no_log_co-re.ll: %.c %.d calculate-flags
$(COMPILE)
%_debug_co-re.ll: %.c %.d calculate-flags
$(COMPILE)

bin/%_v4.o: %_v4.ll | bin
$(LINK)
Expand All @@ -313,7 +288,7 @@ bin:
.PRECIOUS: %.d %_v6.d

COMPILE_DEPS=set -e; rm -f $@; \
$(CC) -MP -M $(CFLAGS) -DBPF_CORE_SUPPORTED $< > $@.$$$$ || { rm -f $@.$$$$; false; } ; \
$(CC) -MP -M $(CFLAGS) $< > $@.$$$$ || { rm -f $@.$$$$; false; } ; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$

Expand Down
8 changes: 0 additions & 8 deletions felix/bpf-gpl/bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,15 @@ static CALI_BPF_INLINE __attribute__((noreturn)) void bpf_exit(int rc) {

#ifdef IPVER6

#ifdef BPF_CORE_SUPPORTED
#define IP_FMT "[%pI6]"
#define debug_ip(ip) (&(ip))
#else
#define debug_ip(ip) (bpf_htonl((ip).d))
#endif
#define ip_is_dnf(ip) (true)
#define ip_is_frag(ip) (false)

#else

#ifdef BPF_CORE_SUPPORTED
#define IP_FMT "%pI4"
#define debug_ip(ip) (&(ip))
#else
#define debug_ip(ip) bpf_htonl(ip)
#endif

#define ip_is_dnf(ip) ((ip)->frag_off & bpf_htons(0x4000))
#define ip_is_frag(ip) ((ip)->frag_off & bpf_htons(0x3fff))
Expand Down
4 changes: 0 additions & 4 deletions felix/bpf-gpl/calculate-flags
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
filename=$1 # Example: from_wep_host_drop_fib_debug.o
args=()

if [[ "${filename}" =~ .*co-re.* ]]; then
args+=("-DBPF_CORE_SUPPORTED")
fi
if [[ "${filename}" =~ .*debug.* ]]; then
args+=("-DCALI_LOG_LEVEL=CALI_LOG_LEVEL_DEBUG")
elif [[ "${filename}" =~ .*no_log.* ]]; then
Expand All @@ -24,7 +21,6 @@ fi

if [[ "${filename}" =~ test_.* ]]; then
args+=("-DUNITTEST")
args+=("-DBPF_CORE_SUPPORTED")
fi

if [[ "${filename}" =~ .*_v6.ll ]]; then
Expand Down
27 changes: 0 additions & 27 deletions felix/bpf-gpl/connect_balancer_v46.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,7 @@ int calico_connect_v46(struct bpf_sock_addr *ctx)
int ret = 1;
__be32 ipv4;

#ifdef BPF_CORE_SUPPORTED
CALI_DEBUG("connect_v46 %pI6", ctx->user_ip6);
#else
CALI_DEBUG("connect_v46 ip[0-1] %x%x",
ctx->user_ip6[0],
ctx->user_ip6[1]);
CALI_DEBUG("connect_v46 ip[2-3] %x%x",
ctx->user_ip6[2],
ctx->user_ip6[3]);
#endif

if (is_ipv4_as_ipv6(ctx->user_ip6)) {
goto v4;
Expand Down Expand Up @@ -74,16 +65,7 @@ int calico_sendmsg_v46(struct bpf_sock_addr *ctx)

__be32 ipv4;

#ifdef BPF_CORE_SUPPORTED
CALI_DEBUG("sendmsg_v46 %pI6", ctx->user_ip6);
#else
CALI_DEBUG("sendmsg_v46 ip[0-1] %x%x",
ctx->user_ip6[0],
ctx->user_ip6[1]);
CALI_DEBUG("sendmsg_v46 ip[2-3] %x%x",
ctx->user_ip6[2],
ctx->user_ip6[3]);
#endif

if (is_ipv4_as_ipv6(ctx->user_ip6)) {
goto v4;
Expand Down Expand Up @@ -115,16 +97,7 @@ int calico_recvmsg_v46(struct bpf_sock_addr *ctx)

__be32 ipv4;

#ifdef BPF_CORE_SUPPORTED
CALI_DEBUG("recvmsg_v46 %pI6", ctx->user_ip6);
#else
CALI_DEBUG("recvmsg_v46 ip[0-1] %x%x",
ctx->user_ip6[0],
ctx->user_ip6[1]);
CALI_DEBUG("recvmsg_v46 ip[2-3] %x%x",
ctx->user_ip6[2],
ctx->user_ip6[3]);
#endif

if (is_ipv4_as_ipv6(ctx->user_ip6)) {
goto v4;
Expand Down
4 changes: 0 additions & 4 deletions felix/bpf-gpl/connect_balancer_v6.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@

#undef debug_ip

#ifdef BPF_CORE_SUPPORTED
#define IP_FMT "[%pI6]"
#define debug_ip(ip) (&(ip))
#else
#define debug_ip(ip) (bpf_htonl((ip)[3]))
#endif

SEC("cgroup/connect6")
int calico_connect_v6(struct bpf_sock_addr *ctx)
Expand Down
4 changes: 0 additions & 4 deletions felix/bpf-gpl/fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
#define __CALI_FIB_H__

#include "fib_common.h"
#ifdef BPF_CORE_SUPPORTED
#include "fib_co_re.h"
#else
#include "fib_legacy.h"
#endif

#endif /* __CALI_FIB_H__ */
Loading
Loading