accept02: Join the multicast group on lo The test joins the multicast group with interface 0. Then the kernel needs a route to 224.0.0.0 to find a device. When we only have lo, like in a QEMU guest with no network, there is no such route and the test breaks: accept02.c:52: TBROK: setsockopt(3, 0, 42, ...) failed: ENODEV (19) All traffic in the test goes over 127.0.0.1, so join the group on lo. Link: https://lore.kernel.org/ltp/[email protected]/ Reviewed-by: Petr Vorel <[email protected]> Reviewed-by: Martin Doucha <[email protected]> Tested-by: Martin Doucha <[email protected]> Signed-off-by: Anders Roxell <[email protected]>
diff --git a/testcases/kernel/syscalls/accept/accept02.c b/testcases/kernel/syscalls/accept/accept02.c index 1705662..09a1c35 100644 --- a/testcases/kernel/syscalls/accept/accept02.c +++ b/testcases/kernel/syscalls/accept/accept02.c
@@ -22,6 +22,7 @@ #include <errno.h> #include <sys/socket.h> #include "tst_test.h" +#include "tst_netdevice.h" #include "tst_safe_net.h" #include "tst_safe_pthread.h" @@ -112,7 +113,7 @@ client_addr = tst_alloc(sizeof(*client_addr)); mc_group = tst_alloc(sizeof(*mc_group)); - mc_group->gr_interface = 0; + mc_group->gr_interface = NETDEV_INDEX_BY_NAME("lo"); mc_group_addr = (struct sockaddr_in *) &mc_group->gr_group; mc_group_addr->sin_family = AF_INET; inet_aton(MULTICASTIP, &mc_group_addr->sin_addr);