]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/bpf: fix "bind{4, 6} deny specific IP & port" on s390
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 14 Aug 2019 10:41:09 +0000 (12:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Sep 2019 05:18:28 +0000 (07:18 +0200)
commit840aec7a8b483429f25c2963a6ba302b22c0a4ee
treebd76d63b8b948465633d0e98512489c4ac885ea5
parent99eb87b50faa264105a40343a31c72211ec5e9e3
selftests/bpf: fix "bind{4, 6} deny specific IP & port" on s390

[ Upstream commit 27df5c7068bf23cab282dc64b1c9894429b3b8a0 ]

"bind4 allow specific IP & port" and "bind6 deny specific IP & port"
fail on s390 because of endianness issue: the 4 IP address bytes are
loaded as a word and compared with a constant, but the value of this
constant should be different on big- and little- endian machines, which
is not the case right now.

Use __bpf_constant_ntohl to generate proper value based on machine
endianness.

Fixes: 1d436885b23b ("selftests/bpf: Selftest for sys_bind post-hooks.")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_sock.c