mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
Merge pull request #17521 from poettering/resolved-more-fixes
six fixes to resolved
This commit is contained in:
commit
585d7a893e
@ -173,7 +173,7 @@
|
||||
<citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -11,6 +11,9 @@
|
||||
DnsAnswer *dns_answer_new(size_t n) {
|
||||
DnsAnswer *a;
|
||||
|
||||
if (n > UINT16_MAX) /* We can only place 64K RRs in an answer at max */
|
||||
n = UINT16_MAX;
|
||||
|
||||
a = malloc0(offsetof(DnsAnswer, items) + sizeof(DnsAnswerItem) * n);
|
||||
if (!a)
|
||||
return NULL;
|
||||
@ -624,12 +627,16 @@ int dns_answer_reserve(DnsAnswer **a, size_t n_free) {
|
||||
return -EBUSY;
|
||||
|
||||
ns = (*a)->n_rrs + n_free;
|
||||
if (ns > UINT16_MAX) /* Maximum number of RRs we can stick into a DNS packet section */
|
||||
ns = UINT16_MAX;
|
||||
|
||||
if ((*a)->n_allocated >= ns)
|
||||
return 0;
|
||||
|
||||
/* Allocate more than we need */
|
||||
ns *= 2;
|
||||
if (ns > UINT16_MAX)
|
||||
ns = UINT16_MAX;
|
||||
|
||||
n = realloc(*a, offsetof(DnsAnswer, items) + sizeof(DnsAnswerItem) * ns);
|
||||
if (!n)
|
||||
@ -706,7 +713,7 @@ void dns_answer_dump(DnsAnswer *answer, FILE *f) {
|
||||
fputs("\t;", f);
|
||||
|
||||
if (ifindex != 0)
|
||||
printf(" ifindex=%i", ifindex);
|
||||
fprintf(f, " ifindex=%i", ifindex);
|
||||
if (flags & DNS_ANSWER_AUTHENTICATED)
|
||||
fputs(" authenticated", f);
|
||||
if (flags & DNS_ANSWER_CACHEABLE)
|
||||
|
@ -1813,6 +1813,8 @@ int dnssec_nsec_test(DnsAnswer *answer, DnsResourceKey *key, DnssecNsecResult *r
|
||||
|
||||
/* The following checks only make sense for NSEC RRs that are not expanded from a wildcard */
|
||||
r = dns_resource_record_is_synthetic(rr);
|
||||
if (r == -ENODATA) /* No signing RR known. */
|
||||
continue;
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r > 0)
|
||||
|
@ -8,7 +8,8 @@
|
||||
DnsQuestion *dns_question_new(size_t n) {
|
||||
DnsQuestion *q;
|
||||
|
||||
assert(n > 0);
|
||||
if (n > UINT16_MAX) /* We can only place 64K key in an question section at max */
|
||||
n = UINT16_MAX;
|
||||
|
||||
q = malloc0(offsetof(DnsQuestion, keys) + sizeof(DnsResourceKey*) * n);
|
||||
if (!q)
|
||||
|
@ -1650,7 +1650,7 @@ DnsResourceRecord *dns_resource_record_copy(DnsResourceRecord *rr) {
|
||||
return NULL;
|
||||
copy->nsec3.salt_size = rr->nsec3.salt_size;
|
||||
copy->nsec3.next_hashed_name = memdup(rr->nsec3.next_hashed_name, rr->nsec3.next_hashed_name_size);
|
||||
if (!copy->nsec3.next_hashed_name_size)
|
||||
if (!copy->nsec3.next_hashed_name)
|
||||
return NULL;
|
||||
copy->nsec3.next_hashed_name_size = rr->nsec3.next_hashed_name_size;
|
||||
copy->nsec3.types = bitmap_copy(rr->nsec3.types);
|
||||
|
@ -1156,12 +1156,16 @@ bool dns_scope_name_wants_search_domain(DnsScope *s, const char *name) {
|
||||
bool dns_scope_network_good(DnsScope *s) {
|
||||
/* Checks whether the network is in good state for lookups on this scope. For mDNS/LLMNR/Classic DNS scopes
|
||||
* bound to links this is easy, as they don't even exist if the link isn't in a suitable state. For the global
|
||||
* DNS scope we check whether there are any links that are up and have an address. */
|
||||
* DNS scope we check whether there are any links that are up and have an address.
|
||||
*
|
||||
* Note that Linux routing is complex and even systems that superficially have no IPv4 address might
|
||||
* be able to route IPv4 (and similar for IPv6), hence let's make a check here independent of address
|
||||
* family. */
|
||||
|
||||
if (s->link)
|
||||
return true;
|
||||
|
||||
return manager_routable(s->manager, AF_UNSPEC);
|
||||
return manager_routable(s->manager);
|
||||
}
|
||||
|
||||
int dns_scope_ifindex(DnsScope *s) {
|
||||
|
@ -1418,15 +1418,15 @@ void manager_dnssec_verdict(Manager *m, DnssecVerdict verdict, const DnsResource
|
||||
m->n_dnssec_verdict[verdict]++;
|
||||
}
|
||||
|
||||
bool manager_routable(Manager *m, int family) {
|
||||
bool manager_routable(Manager *m) {
|
||||
Link *l;
|
||||
|
||||
assert(m);
|
||||
|
||||
/* Returns true if the host has at least one interface with a routable address of the specified type */
|
||||
/* Returns true if the host has at least one interface with a routable address (regardless if IPv4 or IPv6) */
|
||||
|
||||
HASHMAP_FOREACH(l, m->links)
|
||||
if (link_relevant(l, family, false))
|
||||
if (link_relevant(l, AF_UNSPEC, false))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -185,7 +185,7 @@ DnsOverTlsMode manager_get_dns_over_tls_mode(Manager *m);
|
||||
|
||||
void manager_dnssec_verdict(Manager *m, DnssecVerdict verdict, const DnsResourceKey *key);
|
||||
|
||||
bool manager_routable(Manager *m, int family);
|
||||
bool manager_routable(Manager *m);
|
||||
|
||||
void manager_flush_caches(Manager *m);
|
||||
void manager_reset_server_features(Manager *m);
|
||||
|
Loading…
x
Reference in New Issue
Block a user