Skip to content

Commit

Permalink
loxilb-io/loxilb#877 fixed masq related regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Dec 22, 2024
1 parent cf07c28 commit 1cfaaf8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions kernel/llb_kern_devif.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ dp_ing_ct_main(void *ctx, struct xfi *xf)
}
xf->nm.ct_sts = LLB_PIPE_CT_INP;

dp_l3tun_fwd(ctx, xf, fa);
dp_eg_l2(ctx, xf, fa);

res_end:
Expand Down
37 changes: 31 additions & 6 deletions kernel/llb_kern_l3fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,14 @@ dp_do_ing_ct(void *ctx, struct xfi *xf, void *fa_)
static void __always_inline
dp_do_ipv4_fwd(void *ctx, struct xfi *xf, void *fa_)
{
/* Check tunnel initiation */
if (xf->tm.tunnel_id == 0 || xf->tm.tun_type != LLB_TUN_GTP) {
dp_do_sess4_lkup(ctx, xf);
}
#ifndef HAVE_DP_LBMODE_ONLY
if (xf->pm.phit & LLB_DP_TMAC_HIT) {
#else
if (1) {
#endif

/* If some pipeline block already set a redirect before this,
* we honor this and dont do further l3 processing
* we honor this and dont do further l3 processing
*/
if ((xf->pm.pipe_act & LLB_PIPE_RDR_MASK) == 0) {
dp_do_rtv4(ctx, xf, fa_);
Expand All @@ -440,6 +436,34 @@ dp_do_ipv6_fwd(void *ctx, struct xfi *xf, void *fa_)
}
}

static int __always_inline
dp_l3tun_fwd(void *ctx, struct xfi *xf, void *fa)
{
if (xf->l2m.dl_type == bpf_htons(ETH_P_IP)) {
/* Check tunnel initiation */
if (xf->tm.tunnel_id == 0 || xf->tm.tun_type != LLB_TUN_GTP) {
dp_do_sess4_lkup(ctx, xf);
if (xf->tm.new_tunnel_id == 0) {
return 0;
}
}
#ifndef HAVE_DP_LBMODE_ONLY
if (xf->pm.phit & LLB_DP_TMAC_HIT) {
#else
if (1) {
#endif

/* If some pipeline block already set a redirect before this,
* we honor this and dont do further l3 processing
*/
if ((xf->pm.pipe_act & LLB_PIPE_RDR_MASK) == 0) {
dp_do_rtv4(ctx, xf, fa);
}
}
}
return 0;
}

static int __always_inline
dp_l3_fwd(void *ctx, struct xfi *xf, void *fa)
{
Expand Down Expand Up @@ -472,8 +496,9 @@ dp_ing_l3(void *ctx, struct xfi *xf, void *fa)
}
}

dp_do_ing_ct(ctx, xf, fa);
dp_l3_fwd(ctx, xf, fa);
dp_do_ing_ct(ctx, xf, fa);
dp_l3tun_fwd(ctx, xf, fa);

return 0;
}

0 comments on commit 1cfaaf8

Please sign in to comment.