Skip to content

Commit 01bbf4c

Browse files
committed
[BPF] improve failure reason reporting
1 parent bc38a4d commit 01bbf4c

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
@@ -42,7 +42,6 @@ static CALI_BPF_INLINE void fib_error_log(struct cali_tc_ctx *ctx,int rc)
4242
static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
4343
{
4444
int rc = ctx->fwd.res;
45-
enum calico_reason reason = ctx->fwd.reason;
4645
struct cali_tc_state *state = ctx->state;
4746

4847
if (rc == TC_ACT_SHOT) {
@@ -362,7 +361,7 @@ static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
362361
#endif
363362

364363
if (!fib_approve(ctx, fib_params(ctx)->ifindex)) {
365-
reason = CALI_REASON_WEP_NOT_READY;
364+
ctx->fwd.reason = CALI_REASON_WEP_NOT_READY;
366365
goto deny;
367366
}
368367

@@ -512,7 +511,7 @@ static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
512511

513512
if (rc == TC_ACT_SHOT) {
514513
CALI_INFO("Final result=DENY (%d). Program execution time: %lluns",
515-
reason, prog_end_time-state->prog_start_time);
514+
ctx->fwd.reason, prog_end_time-state->prog_start_time);
516515
} else {
517516
if (CALI_F_VXLAN && CALI_F_TO_HOST) {
518517
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)