Skip to content

Commit 1fa7fb1

Browse files
committed
[BPF] improve failure reason reporting
1 parent 8d09c11 commit 1fa7fb1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

felix/bpf-gpl/fib_co_re.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ static CALI_BPF_INLINE void fib_error_log(struct cali_tc_ctx *ctx,int rc)
4141
static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
4242
{
4343
int rc = ctx->fwd.res;
44-
enum calico_reason reason = ctx->fwd.reason;
4544
struct cali_tc_state *state = ctx->state;
4645

4746
if (rc == TC_ACT_SHOT) {
@@ -356,7 +355,7 @@ static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
356355
#endif
357356

358357
if (!fib_approve(ctx, fib_params(ctx)->ifindex)) {
359-
reason = CALI_REASON_WEP_NOT_READY;
358+
ctx->fwd.reason = CALI_REASON_WEP_NOT_READY;
360359
goto deny;
361360
}
362361

@@ -506,7 +505,7 @@ static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
506505

507506
if (rc == TC_ACT_SHOT) {
508507
CALI_INFO("Final result=DENY (%d). Program execution time: %lluns",
509-
reason, prog_end_time-state->prog_start_time);
508+
ctx->fwd.reason, prog_end_time-state->prog_start_time);
510509
} else {
511510
if (CALI_F_VXLAN && CALI_F_TO_HOST) {
512511
bpf_skb_change_type(ctx->skb, PACKET_HOST);

felix/bpf-gpl/tc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ static CALI_BPF_INLINE enum do_nat_res do_nat(struct cali_tc_ctx *ctx,
792792
*/
793793
rt = cali_rt_lookup(&STATE->post_nat_ip_dst);
794794
if (!rt) {
795+
CALI_DEBUG("missing rt found for " IP_FMT, debug_ip(STATE->post_nat_ip_dst));
795796
deny_reason(ctx, CALI_REASON_RT_UNKNOWN);
796797
goto deny;
797798
}

0 commit comments

Comments
 (0)