diff options
| author | Matthieu Buffet <matthieu@buffet.re> | 2025-10-27 20:07:24 +0100 |
|---|---|---|
| committer | Mickaël Salaün <mic@digikod.net> | 2025-12-26 20:38:57 +0100 |
| commit | bd09d9a05cf04028f639e209b416bacaeffd4909 (patch) | |
| tree | d9a6659dcac9b1fe4b97686318fce7c972aa0088 /scripts/basic | |
| parent | e4d82cbce2258f454634307fdabf33aa46b61ab0 (diff) | |
selftests/landlock: Fix TCP bind(AF_UNSPEC) test case
The nominal error code for bind(AF_UNSPEC) on an IPv6 socket
is -EAFNOSUPPORT, not -EINVAL. -EINVAL is only returned when
the supplied address struct is too short, which happens to be
the case in current selftests because they treat AF_UNSPEC
like IPv4 sockets do: as an alias for AF_INET (which is a
16-byte struct instead of the 24 bytes required by IPv6
sockets).
Make the union large enough for any address (by adding struct
sockaddr_storage to the union), and make AF_UNSPEC addresses
large enough for any family.
Test for -EAFNOSUPPORT instead, and add a dedicated test case
for truncated inputs with -EINVAL.
Fixes: a549d055a22e ("selftests/landlock: Add network tests")
Signed-off-by: Matthieu Buffet <matthieu@buffet.re>
Link: https://lore.kernel.org/r/20251027190726.626244-2-matthieu@buffet.re
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
