Skip to content

Commit

Permalink
never forward blindly if natin/out dev is involved
Browse files Browse the repository at this point in the history
  • Loading branch information
tomastigera committed Nov 1, 2024
1 parent 5f68541 commit 2f15c59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions felix/bpf-gpl/fib_co_re.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ static CALI_BPF_INLINE int forward_or_drop(struct cali_tc_ctx *ctx)
goto cancel_fib;
}

if (CALI_F_TO_HOST &&
ct_result_is_confirmed(state->ct_result.rc) &&
state->ct_result.ifindex_fwd != CT_INVALID_IFINDEX ) {
if (CALI_F_TO_HOST && ct_result_is_confirmed(state->ct_result.rc) &&
state->ct_result.ifindex_fwd != CT_INVALID_IFINDEX &&
!(state->ct_result.flags & CALI_CT_FLAG_VIA_NAT_IF)) {
rc = bpf_redirect_neigh(state->ct_result.ifindex_fwd, NULL, 0, 0);
if (rc == TC_ACT_REDIRECT) {
CALI_DEBUG("Redirect to dev %d without fib lookup", state->ct_result.ifindex_fwd);
Expand Down
2 changes: 1 addition & 1 deletion felix/bpf-gpl/tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ static CALI_BPF_INLINE struct fwd post_nat(struct cali_tc_ctx *ctx,
} else if (!r || cali_rt_flags_remote_workload(r->flags)) {
/* If there is no route, treat it as a remote NP BE */
if (CALI_F_LO || CALI_F_MAIN) {
state->ct_result.ifindex_fwd = NATIN_IFACE ;
state->ct_result.ifindex_fwd = NATIN_IFACE;
CALI_DEBUG("NP remote WL " IP_FMT ":%d on LO or main HEP",
debug_ip(state->post_nat_ip_dst), state->post_nat_dport);
ctx->state->flags |= CALI_ST_CT_NP_LOOP;
Expand Down

0 comments on commit 2f15c59

Please sign in to comment.