Skip to content

Commit b6a3451

Browse files
JeroenvISborkmann
authored andcommitted
selftests/bpf: Fix erroneous bitmask operation
xdp_synproxy_kern.c is a BPF program that generates SYN cookies on allowed TCP ports and sends SYNACKs to clients, accelerating synproxy iptables module. Fix the bitmask operation when checking the status of an existing conntrack entry within tcp_lookup() function. Do not AND with the bit position number, but with the bitmask value to check whether the entry found has the IPS_CONFIRMED flag set. Fixes: fb5cd0c ("selftests/bpf: Add selftests for raw syncookie helpers") Signed-off-by: Jeroen van Ingen Schenau <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Minh Le Hoang <[email protected]> Link: https://lore.kernel.org/xdp-newbies/CAAi1gX7owA+Tcxq-titC-h-KPM7Ri-6ZhTNMhrnPq5gmYYwKow@mail.gmail.com/T/#u Link: https://lore.kernel.org/bpf/[email protected]
1 parent 15bc812 commit b6a3451

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/bpf/progs/xdp_synproxy_kern.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,13 @@ static __always_inline int tcp_lookup(void *ctx, struct header_pointers *hdr, bo
467467
unsigned long status = ct->status;
468468

469469
bpf_ct_release(ct);
470-
if (status & IPS_CONFIRMED_BIT)
470+
if (status & IPS_CONFIRMED)
471471
return XDP_PASS;
472472
} else if (ct_lookup_opts.error != -ENOENT) {
473473
return XDP_ABORTED;
474474
}
475475

476-
/* error == -ENOENT || !(status & IPS_CONFIRMED_BIT) */
476+
/* error == -ENOENT || !(status & IPS_CONFIRMED) */
477477
return XDP_TX;
478478
}
479479

0 commit comments

Comments
 (0)