LIST_FOREACH(scopes, s, q->manager->dns_scopes) {
DnsScopeMatch match;
- const char *name;
- name = dns_question_first_name(dns_query_question_for_protocol(q, s->protocol));
- if (!name)
- continue;
-
- match = dns_scope_good_domain(s, q->ifindex, q->flags, name);
+ match = dns_scope_good_domain(s, q);
assert(match >= 0);
if (match > found) { /* Does this match better? If so, remember how well it matched, and the first one
* that matches this well */
LIST_FOREACH(scopes, s, first->scopes_next) {
DnsScopeMatch match;
- const char *name;
-
- name = dns_question_first_name(dns_query_question_for_protocol(q, s->protocol));
- if (!name)
- continue;
- match = dns_scope_good_domain(s, q->ifindex, q->flags, name);
+ match = dns_scope_good_domain(s, q);
assert(match >= 0);
if (match < found)
continue;
DnsScopeMatch dns_scope_good_domain(
DnsScope *s,
- int ifindex,
- uint64_t flags,
- const char *domain) {
+ DnsQuery *q) {
+ DnsQuestion *question;
DnsSearchDomain *d;
+ const char *domain;
+ uint64_t flags;
+ int ifindex;
/* This returns the following return values:
*
*/
assert(s);
- assert(domain);
+ assert(q);
+
+ question = dns_query_question_for_protocol(q, s->protocol);
+ if (!question)
+ return DNS_SCOPE_NO;
+
+ domain = dns_question_first_name(question);
+ if (!domain)
+ return DNS_SCOPE_NO;
+
+ ifindex = q->ifindex;
+ flags = q->flags;
/* Checks if the specified domain is something to look up on this scope. Note that this accepts
* non-qualified hostnames, i.e. those without any search path suffixed. */
#include "resolved-dns-cache.h"
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
-
+#include "resolved-dns-query.h"
#include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stream.h"
int dns_scope_socket_tcp(DnsScope *s, int family, const union in_addr_union *address, DnsServer *server, uint16_t port, union sockaddr_union *ret_socket_address);
int dns_scope_socket_udp(DnsScope *s, DnsServer *server);
-DnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, const char *domain);
+DnsScopeMatch dns_scope_good_domain(DnsScope *s, DnsQuery *q);
bool dns_scope_good_key(DnsScope *s, const DnsResourceKey *key);
DnsServer *dns_scope_get_dns_server(DnsScope *s);