]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: transaction - don't request PKTINFO for unicast DNS
authorTom Gundersen <teg@jklm.no>
Sat, 25 Jul 2015 02:38:25 +0000 (04:38 +0200)
committerTom Gundersen <teg@jklm.no>
Mon, 27 Jul 2015 17:56:45 +0000 (19:56 +0200)
This was only ever used by LLMNR, so don't request this for unicast DNS packets.

src/resolve/resolved-dns-transaction.c
src/resolve/resolved-manager.c

index 4644f8a9e1bedb92255334b99c17af6da547282f..e8413d423468d7a011fa0fe086a31d947eda78fa 100644 (file)
@@ -654,7 +654,6 @@ static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *use
 }
 
 int transaction_dns_fd(DnsTransaction *t) {
-        const int one = 1;
         int r;
 
         assert(t);
@@ -668,21 +667,6 @@ int transaction_dns_fd(DnsTransaction *t) {
         if (t->dns_fd < 0)
                 return -errno;
 
-        switch (t->scope->family) {
-        case AF_INET:
-                r = setsockopt(t->dns_fd, IPPROTO_IP, IP_PKTINFO, &one, sizeof(one));
-                break;
-        case AF_INET6:
-                r = setsockopt(t->dns_fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &one, sizeof(one));
-                break;
-        default:
-                return -EAFNOSUPPORT;
-        }
-        if (r < 0) {
-                r = -errno;
-                goto fail;
-        }
-
         r = sd_event_add_io(t->scope->manager->event, &t->dns_event_source, t->dns_fd, EPOLLIN, on_dns_packet, t);
         if (r < 0)
                 goto fail;
index 17de14bae1eb95dab4c695bd0c824e5dc76e01cc..9fda64ba39d518c4c282d7ed7596073ec721e09e 100644 (file)
@@ -912,10 +912,12 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
         if (p->ifindex == LOOPBACK_IFINDEX)
                 p->ifindex = 0;
 
-        /* If we don't know the interface index still, we look for the
-         * first local interface with a matching address. Yuck! */
-        if (p->ifindex <= 0)
-                p->ifindex = manager_find_ifindex(m, p->family, &p->destination);
+        if (protocol != DNS_PROTOCOL_DNS) {
+                /* If we don't know the interface index still, we look for the
+                 * first local interface with a matching address. Yuck! */
+                if (p->ifindex <= 0)
+                        p->ifindex = manager_find_ifindex(m, p->family, &p->destination);
+        }
 
         *ret = p;
         p = NULL;