bpf: fix error check in bpf_tcp_gen_syncookie
Subsystems (4)
From: Petar Penkov <[email protected]>
If a SYN cookie is not issued by tcp_v#_gen_syncookie, then the return value will be exactly 0, rather than <= 0. Let's change the check to reflect that, especially since mss is an unsigned value and cannot be negative.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -5903,7 +5903,7 @@ BPF_CALL_5(bpf_tcp_gen_syncookie, struct sock *, sk, void *, iph, u32, iph_len,default :return -EPROTONOSUPPORT ; } -if (mss <=0 ) +if (mss ==0 )return -ENOENT ;return cookie | ((u64 )mss <<32 );
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Song Liu
Acked-byQuoted 11 lines · Petar Penkov
From: Petar Penkov <[email protected]>
If a SYN cookie is not issued by tcp_v#_gen_syncookie, then the return value will be exactly 0, rather than <= 0. Let's change the check to reflect that, especially since mss is an unsigned value and cannot be negative.
Fixes 70d66244317e ("bpf: add bpf_tcp_gen_syncookie helper")Reported-by Stanislav Fomichev <[email protected]>Signed-off-by Petar Penkov <[email protected]>
Quoted 10 lines · Petar Penkov
From: Petar Penkov <[email protected]>
If a SYN cookie is not issued by tcp_v#_gen_syncookie, then the return value will be exactly 0, rather than <= 0. Let's change the check to reflect that, especially since mss is an unsigned value and cannot be negative.
Fixes 70d66244317e ("bpf: add bpf_tcp_gen_syncookie helper")Reported-by Stanislav Fomichev <[email protected]>Signed-off-by Petar Penkov <[email protected]>
Applied, thanks!