Skip to content

Commit 3d6baf8

Browse files
committed
fix: erroneous bitmask operation
In kernel selftest/bpf xdp synproxy has: [0] b6a3451e084 (selftests/bpf: Fix erroneous bitmask operation) sync the fix here. It addresses an issue when xdp synproxy need to handle SYNACK from backend server, see [1]. [0]: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=b6a3451e0847 [1]: https://lore.kernel.org/xdp-newbies/CAK3+h2z1r69Z5g+qTwCaJzgnD5sv93x67TLJ3gVQ70_nFE0AqQ@mail.gmail.com/T/#t Signed-off-by: Vincent Li <[email protected]>
1 parent b9d1f89 commit 3d6baf8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

headers/vmlinux/vmlinux_net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ struct nf_conn {
142142
enum ip_conntrack_status {
143143
/* Connection is confirmed: originating packet has left box */
144144
IPS_CONFIRMED_BIT = 3,
145+
IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT),
145146
};
146147

147148
#endif /* __VMLINUX_NET_H__ */

xdp-synproxy/xdp_synproxy_kern.c

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

449449
bpf_ct_release(ct);
450-
if (status & IPS_CONFIRMED_BIT)
450+
if (status & IPS_CONFIRMED)
451451
return XDP_PASS;
452452
} else if (ct_lookup_opts.error != -ENOENT) {
453453
return XDP_ABORTED;
454454
}
455455

456-
/* error == -ENOENT || !(status & IPS_CONFIRMED_BIT) */
456+
/* error == -ENOENT || !(status & IPS_CONFIRMED) */
457457
return XDP_TX;
458458
}
459459

0 commit comments

Comments
 (0)