提交 0741be35 编写于 作者: P Petar Penkov 提交者: 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: NStanislav Fomichev <sdf@google.com>
Signed-off-by: NPetar Penkov <ppenkov@google.com>
Acked-by: NSong Liu <songliubraving@fb.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册