Commit 0741be35 authored by Petar Penkov's avatar Petar Penkov Committed by Daniel Borkmann

bpf: fix error check in bpf_tcp_gen_syncookie

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: 70d66244 ("bpf: add bpf_tcp_gen_syncookie helper")
Reported-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarPetar Penkov <ppenkov@google.com>
Acked-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 736a5530
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment