]> git.meshlink.io Git - catta/blobdiff - avahi-core/server.c
reflector: cache entry link-local addresses filter
[catta] / avahi-core / server.c
index a149f0fbc68bd68425cd610a9fd9aaac037b476e..86fd4a551e7341af4d3856687a99dfa6453cc7dd 100644 (file)
@@ -513,12 +513,20 @@ static void reflect_response(AvahiServer *s, AvahiInterface *i, AvahiRecord *r,
 
 static void* reflect_cache_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
     AvahiServer *s = userdata;
+    AvahiRecord* r;
 
     assert(c);
     assert(pattern);
     assert(e);
     assert(s);
 
+    /* Don't reflect cache entry with ipv6 link-local addresses. */
+    r = e->record;
+    if ((r->key->type == AVAHI_DNS_TYPE_AAAA) &&
+            (r->data.aaaa.address.address[0] == 0xFE) &&
+            (r->data.aaaa.address.address[1] == 0x80))
+      return NULL;
+
     avahi_record_list_push(s->record_list, e->record, e->cache_flush, 0, 0);
     return NULL;
 }
@@ -1387,6 +1395,7 @@ AvahiServer *avahi_server_new(const AvahiPoll *poll_api, const AvahiServerConfig
     s->need_entry_cleanup = 0;
     s->need_group_cleanup = 0;
     s->need_browser_cleanup = 0;
+    s->cleanup_time_event = NULL;
     s->hinfo_entry_group = NULL;
     s->browse_domain_entry_group = NULL;
     s->error = AVAHI_OK;
@@ -1486,6 +1495,9 @@ void avahi_server_free(AvahiServer* s) {
         avahi_wide_area_engine_free(s->wide_area_lookup_engine);
     avahi_multicast_lookup_engine_free(s->multicast_lookup_engine);
 
+    if (s->cleanup_time_event)
+        avahi_time_event_free(s->cleanup_time_event);
+
     avahi_time_event_queue_free(s->time_event_queue);
 
     /* Free watches */
@@ -1587,6 +1599,8 @@ AvahiServerConfig* avahi_server_config_init(AvahiServerConfig *c) {
     c->publish_aaaa_on_ipv4 = 1;
     c->publish_a_on_ipv6 = 0;
     c->n_cache_entries_max = AVAHI_DEFAULT_CACHE_ENTRIES_MAX;
+    c->ratelimit_interval = 0;
+    c->ratelimit_burst = 0;
 
     return c;
 }