Skip to content

Commit

Permalink
gh-69 fix for scenario3 issue from cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
PacketCrunch committed Sep 3, 2022
1 parent 3813391 commit 7d93467
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 20 deletions.
13 changes: 12 additions & 1 deletion ebpf/kernel/llb_kern_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,12 @@ dp_ct_tcp_sm(void *ctx, struct xfi *xf,
break;
case CT_TCP_SS:
if (dir != CT_DIR_OUT) {
nstate = CT_TCP_ERR;
if ((tcp_flags & LLB_TCP_SYN) == LLB_TCP_SYN) {
td->seq = seq;
nstate = CT_TCP_SS;
} else {
nstate = CT_TCP_ERR;
}
goto end;
}

Expand All @@ -289,6 +294,12 @@ dp_ct_tcp_sm(void *ctx, struct xfi *xf,
nstate = CT_TCP_ERR;
goto end;
}

if ((tcp_flags & LLB_TCP_SYN) == LLB_TCP_SYN) {
td->seq = seq;
nstate = CT_TCP_SS;
goto end;
}

if ((tcp_flags & LLB_TCP_ACK) != LLB_TCP_ACK) {
nstate = CT_TCP_ERR;
Expand Down
40 changes: 22 additions & 18 deletions ebpf/kernel/llb_kern_devif.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,26 @@ dp_unparse_packet_always(void *ctx, struct xfi *xf)
}
}

if (xf->tm.tun_decap) {
if (xf->tm.tun_type == LLB_TUN_GTP) {
LL_DBG_PRINTK("[DEPR] LL STRIP-GTP\n");
if (dp_do_strip_gtp(ctx, xf, xf->pm.tun_off) != 0) {
return DP_DROP;
}
}
} else if (xf->tm.new_tunnel_id) {
if (xf->tm.tun_type == LLB_TUN_GTP) {
if (dp_do_ins_gtp(ctx, xf,
xf->tm.tun_rip,
xf->tm.tun_sip,
xf->tm.new_tunnel_id,
xf->qm.qfi,
1)) {
return DP_DROP;
}
}
}

return 0;
}

Expand All @@ -244,27 +264,11 @@ dp_unparse_packet(void *ctx, struct xfi *xf)
if (dp_do_strip_vxlan(ctx, xf, xf->pm.tun_off) != 0) {
return DP_DROP;
}
} else if (xf->tm.tun_type == LLB_TUN_GTP) {
LL_DBG_PRINTK("[DEPR] LL STRIP-GTP\n");
if (dp_do_strip_gtp(ctx, xf, xf->pm.tun_off) != 0) {
return DP_DROP;
}
}
}

if (xf->tm.new_tunnel_id) {
} else if (xf->tm.new_tunnel_id) {
LL_DBG_PRINTK("[DEPR] LL_NEW-TUN 0x%x\n",
bpf_ntohl(xf->tm.new_tunnel_id));
if (xf->tm.tun_type == LLB_TUN_GTP) {
if (dp_do_ins_gtp(ctx, xf,
xf->tm.tun_rip,
xf->tm.tun_sip,
xf->tm.new_tunnel_id,
xf->qm.qfi,
1)) {
return DP_DROP;
}
} else if (xf->tm.tun_type == LLB_TUN_VXLAN) {
if (xf->tm.tun_type == LLB_TUN_VXLAN) {
if (dp_do_ins_vxlan(ctx, xf,
xf->tm.tun_rip,
xf->tm.tun_sip,
Expand Down
6 changes: 5 additions & 1 deletion ebpf/kernel/llb_kern_l2fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ dp_do_smac_lkup(void *ctx, struct xfi *xf, void *fc)
struct dp_smac_key key;
struct dp_smac_tact *sma;

if (xf->l2m.vlan[0] == 0) {
return 0;
}

memcpy(key.smac, xf->l2m.dl_src, 6);
key.bd = xf->pm.bd;

Expand Down Expand Up @@ -282,7 +286,7 @@ dp_do_nh_lkup(void *ctx, struct xfi *xf, void *fa_)
nha = bpf_map_lookup_elem(&nh_map, &key);
if (!nha) {
/* No NH - Drop */
LLBS_PPLN_DROP(xf);
LLBS_PPLN_TRAP(xf)
return 0;
}

Expand Down

0 comments on commit 7d93467

Please sign in to comment.