summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-11-06 10:26:44 +0100
committerLennart Poettering <lennart@poettering.net>2020-12-03 23:23:11 +0100
commit877884fc0da76170dce5abe7b3883eee334156b1 (patch)
tree9995c866668de00ecd85e2eddd31795115bd4e79
parentc3a8c6aa42092d87b73a3653d96258bbfe32fd28 (diff)
downloadsystemd-877884fc0da76170dce5abe7b3883eee334156b1.tar.gz
resolved: synthesize NODATA instead of NXDOMAIN if gateway exists, but of other protocol
Fixes: #11192
-rw-r--r--src/resolve/resolved-dns-synthesize.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-synthesize.c b/src/resolve/resolved-dns-synthesize.c
index 67f0dda246..f08d62116a 100644
--- a/src/resolve/resolved-dns-synthesize.c
+++ b/src/resolve/resolved-dns-synthesize.c
@@ -322,8 +322,24 @@ static int synthesize_gateway_rr(Manager *m, const DnsResourceKey *key, int ifin
af = dns_type_to_af(key->type);
if (af >= 0) {
n = local_gateways(m->rtnl, ifindex, af, &addresses);
- if (n <= 0)
- return n; /* < 0 means: error; == 0 means we have no gateway */
+ if (n < 0) /* < 0 means: error */
+ return n;
+
+ if (n == 0) { /* == 0 means we have no gateway */
+ /* See if there's a gateway on the other protocol */
+ if (af == AF_INET)
+ n = local_gateways(m->rtnl, ifindex, AF_INET6, NULL);
+ else {
+ assert(af == AF_INET6);
+ n = local_gateways(m->rtnl, ifindex, AF_INET, NULL);
+ }
+ if (n <= 0) /* error (if < 0) or really no gateway at all (if == 0) */
+ return n;
+
+ /* We have a gateway on the other protocol. Let's return > 0 without adding any RR to
+ * the answer, i.e. synthesize NODATA (and not NXDOMAIN!) */
+ return 1;
+ }
}
r = answer_add_addresses_rr(answer, dns_resource_key_name(key), addresses, n);