chiark / gitweb /
terminal/screen: add color converter
[elogind.git] / src / resolve / resolved-dns-scope.c
index 174249a9f762f7977cda2ed2052eef71b8dc93f7..40d59922d16139640983b3ff9ed0efad15219537 100644 (file)
@@ -291,12 +291,18 @@ int dns_scope_tcp_socket(DnsScope *s, int family, const union in_addr_union *add
         return ret;
 }
 
-DnsScopeMatch dns_scope_good_domain(DnsScope *s, const char *domain) {
+DnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, const char *domain) {
         char **i;
 
         assert(s);
         assert(domain);
 
+        if (ifindex != 0 && (!s->link || s->link->ifindex != ifindex))
+                return DNS_SCOPE_NO;
+
+        if ((SD_RESOLVED_FLAGS_MAKE(s->protocol, s->family) & flags) == 0)
+                return DNS_SCOPE_NO;
+
         STRV_FOREACH(i, s->domains)
                 if (dns_name_endswith(domain, *i) > 0)
                         return DNS_SCOPE_YES;
@@ -359,6 +365,13 @@ int dns_scope_good_key(DnsScope *s, DnsResourceKey *key) {
 int dns_scope_llmnr_membership(DnsScope *s, bool b) {
         int fd;
 
+        assert(s);
+
+        if (s->protocol != DNS_PROTOCOL_LLMNR)
+                return 0;
+
+        assert(s->link);
+
         if (s->family == AF_INET) {
                 struct ip_mreqn mreqn = {
                         .imr_multiaddr = LLMNR_MULTICAST_IPV4_ADDRESS,
@@ -696,7 +709,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) {
 
         /* We don't send these queries immediately. Instead, we queue
          * them, and send them after some jitter delay. */
-        r = hashmap_ensure_allocated(&scope->conflict_queue, dns_resource_key_hash_func, dns_resource_key_compare_func);
+        r = hashmap_ensure_allocated(&scope->conflict_queue, &dns_resource_key_hash_ops);
         if (r < 0) {
                 log_oom();
                 return r;