nss-resolve: shortcut fixing of ifindex if it's zero anyway
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Feb 2021 17:46:18 +0000 (18:46 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Mar 2021 16:35:56 +0000 (17:35 +0100)
(cherry picked from commit 425ed13991153bd274a86009459b00ec8a709f30)

src/nss-resolve/nss-resolve.c

index 8915ab18cfbc1443f357434dfca50e07ebeea0f8..0a5fad109d9f401a8ce0bb5e1997531dc53b803c 100644 (file)
@@ -49,7 +49,7 @@ static int connect_to_resolved(Varlink **ret) {
 static uint32_t ifindex_to_scopeid(int family, const void *a, int ifindex) {
         struct in6_addr in6;
 
-        if (family != AF_INET6)
+        if (family != AF_INET6 || ifindex == 0)
                 return 0;
 
         /* Some apps can't deal with the scope ID attached to non-link-local addresses. Hence, let's suppress that. */