]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: use sockaddr_in_addr()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 17:51:09 +0000 (02:51 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 18:48:07 +0000 (03:48 +0900)
src/resolve/resolved-dns-stream.c

index cf5057ddf09e4848e655225cee716676de77e515..2ab6f6236dcc0744bda94149f4fec70b531e2973 100644 (file)
@@ -187,7 +187,7 @@ static int dns_stream_identify(DnsStream *s) {
         /* If we don't know the interface index still, we look for the
          * first local interface with a matching address. Yuck! */
         if (s->ifindex <= 0)
-                s->ifindex = manager_find_ifindex(s->manager, s->local.sa.sa_family, s->local.sa.sa_family == AF_INET ? (union in_addr_union*) &s->local.in.sin_addr : (union in_addr_union*)  &s->local.in6.sin6_addr);
+                s->ifindex = manager_find_ifindex(s->manager, s->local.sa.sa_family, sockaddr_in_addr(&s->local.sa));
 
         if (s->protocol == DNS_PROTOCOL_LLMNR && s->ifindex > 0) {
                 /* Make sure all packets for this connection are sent on the same interface */