]> git.meshlink.io Git - catta/blobdiff - avahi-core/server.c
core: Don't ignore records with link-local addresss
[catta] / avahi-core / server.c
index bb625a577ca123e4fb90a771400425d9e0065785..6eedd6e8963d68a80af9c569f26d49e1d967b9fe 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of avahi.
 
@@ -659,7 +657,6 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
              avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); n > 0; n--) {
         AvahiRecord *record;
         int cache_flush = 0;
-/*         char *txt; */
 
         if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
             avahi_log_warn(__FILE__": Packet too short or invalid while reading response record. (Maybe a UTF-8 problem?)");
@@ -669,7 +666,7 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
         if (!avahi_key_is_pattern(record->key)) {
 
             if (handle_conflict(s, i, record, cache_flush)) {
-                if (!from_local_iface)
+                if (!from_local_iface && !avahi_record_is_link_local_address(record))
                     reflect_response(s, i, record, cache_flush);
                 avahi_cache_update(i->cache, record, cache_flush, a);
                 avahi_response_scheduler_incoming(i->response_scheduler, record, cache_flush);
@@ -680,7 +677,7 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
     }
 
     /* If the incoming response contained a conflicting record, some
-       records have been scheduling for sending. We need to flush them
+       records have been scheduled for sending. We need to flush them
        here. */
     if (!avahi_record_list_is_empty(s->record_list))
         avahi_server_generate_response(s, i, NULL, NULL, 0, 0, 1);
@@ -1009,13 +1006,6 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p) {
     avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
 }
 
-static void cleanup_dead(AvahiServer *s) {
-    assert(s);
-
-    avahi_cleanup_dead_entries(s);
-    avahi_browser_cleanup(s);
-}
-
 static void mcast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *userdata) {
     AvahiServer *s = userdata;
     AvahiAddress dest, src;
@@ -1044,11 +1034,11 @@ static void mcast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, vo
         if (iface != AVAHI_IF_UNSPEC)
             dispatch_packet(s, p, &src, port, &dest, iface, ttl);
         else
-            avahi_log_error("Incoming packet recieved on address that isn't local.");
+            avahi_log_error("Incoming packet received on address that isn't local.");
 
         avahi_dns_packet_free(p);
 
-        cleanup_dead(s);
+        avahi_cleanup_dead_entries(s);
     }
 }
 
@@ -1071,7 +1061,7 @@ static void legacy_unicast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent e
         dispatch_legacy_unicast_packet(s, p);
         avahi_dns_packet_free(p);
 
-        cleanup_dead(s);
+        avahi_cleanup_dead_entries(s);
     }
 }