mirror of
https://github.com/systemd/systemd
synced 2025-12-26 10:54:45 +01:00
Compare commits
4 Commits
ce9fb09e96
...
62e3a988f2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62e3a988f2 | ||
|
|
877884fc0d | ||
|
|
c3a8c6aa42 | ||
|
|
6c0bacc146 |
@ -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);
|
||||
|
||||
@ -1712,7 +1712,7 @@ int dns_transaction_go(DnsTransaction *t) {
|
||||
if (r == -EMSGSIZE)
|
||||
log_debug("Sending query via TCP since it is too large.");
|
||||
else if (r == -EAGAIN)
|
||||
log_debug("Sending query via TCP since UDP isn't supported.");
|
||||
log_debug("Sending query via TCP since UDP isn't supported or DNS-over-TLS is selected.");
|
||||
if (IN_SET(r, -EMSGSIZE, -EAGAIN))
|
||||
r = dns_transaction_emit_tcp(t);
|
||||
}
|
||||
|
||||
@ -41,8 +41,6 @@ int local_addresses(sd_netlink *context, int ifindex, int af, struct local_addre
|
||||
sd_netlink_message *m;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (context)
|
||||
rtnl = sd_netlink_ref(context);
|
||||
else {
|
||||
@ -135,9 +133,10 @@ int local_addresses(sd_netlink *context, int ifindex, int af, struct local_addre
|
||||
n_list++;
|
||||
};
|
||||
|
||||
typesafe_qsort(list, n_list, address_compare);
|
||||
|
||||
*ret = TAKE_PTR(list);
|
||||
if (ret) {
|
||||
typesafe_qsort(list, n_list, address_compare);
|
||||
*ret = TAKE_PTR(list);
|
||||
}
|
||||
|
||||
return (int) n_list;
|
||||
}
|
||||
@ -179,8 +178,6 @@ int local_gateways(sd_netlink *context, int ifindex, int af, struct local_addres
|
||||
size_t n_list = 0, n_allocated = 0;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (context)
|
||||
rtnl = sd_netlink_ref(context);
|
||||
else {
|
||||
@ -309,9 +306,10 @@ int local_gateways(sd_netlink *context, int ifindex, int af, struct local_addres
|
||||
}
|
||||
}
|
||||
|
||||
typesafe_qsort(list, n_list, address_compare);
|
||||
|
||||
*ret = TAKE_PTR(list);
|
||||
if (ret) {
|
||||
typesafe_qsort(list, n_list, address_compare);
|
||||
*ret = TAKE_PTR(list);
|
||||
}
|
||||
|
||||
return (int) n_list;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user