summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dns-scope.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-02-15 18:18:34 +0100
committerSergey Bugaev <bugaevc@gmail.com>2021-03-31 11:54:08 +0200
commit84b0ff0e327a4cf873791c74efc312c81400be70 (patch)
tree129bf347b42c4e3c9747b5b120f3c4dcedc02221 /src/resolve/resolved-dns-scope.c
parentresolved: fix mistaking QU bit for cache-flush bit (diff)
downloadsystemd-84b0ff0e327a4cf873791c74efc312c81400be70.tar.xz
systemd-84b0ff0e327a4cf873791c74efc312c81400be70.zip
resolved: reply using unicast mDNS when appropriate
Fixes https://github.com/systemd/systemd/issues/18434
Diffstat (limited to 'src/resolve/resolved-dns-scope.c')
-rw-r--r--src/resolve/resolved-dns-scope.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 09f25a65b9..81c62bdca6 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -287,17 +287,23 @@ static int dns_scope_emit_one(DnsScope *s, int fd, int family, DnsPacket *p) {
return -EBUSY;
if (family == AF_INET) {
- addr.in = MDNS_MULTICAST_IPV4_ADDRESS;
+ if (in4_addr_is_null(&p->destination.in))
+ addr.in = MDNS_MULTICAST_IPV4_ADDRESS;
+ else
+ addr = p->destination;
fd = manager_mdns_ipv4_fd(s->manager);
} else if (family == AF_INET6) {
- addr.in6 = MDNS_MULTICAST_IPV6_ADDRESS;
+ if (in6_addr_is_null(&p->destination.in6))
+ addr.in6 = MDNS_MULTICAST_IPV6_ADDRESS;
+ else
+ addr = p->destination;
fd = manager_mdns_ipv6_fd(s->manager);
} else
return -EAFNOSUPPORT;
if (fd < 0)
return fd;
- r = manager_send(s->manager, fd, s->link->ifindex, family, &addr, MDNS_PORT, NULL, p);
+ r = manager_send(s->manager, fd, s->link->ifindex, family, &addr, p->destination_port ?: MDNS_PORT, NULL, p);
if (r < 0)
return r;