From abbe01af59549445fd4995fc3e724caae23dbe27 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 12 Oct 2022 06:46:25 +0200 Subject: [PATCH] icmp: Set sin6_scope_id for outbound ICMPv6 echo requests If we ping a link-local address, we need to pass this to sendto(), as it will obviously fail with -EINVAL otherwise. If we ping other addresses, it's probably a good idea anyway to specify the configured outbound interface here. Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- icmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/icmp.c b/icmp.c index 6bd87fd..21ea2d7 100644 --- a/icmp.c +++ b/icmp.c @@ -192,6 +192,7 @@ int icmp_tap_handler(const struct ctx *c, int af, const void *addr, struct sockaddr_in6 sa = { .sin6_family = AF_INET6, .sin6_addr = IN6ADDR_ANY_INIT, + .sin6_scope_id = c->ifi6, }; struct icmp6hdr *ih; int id, s;