ubus: assume that the service iface can be NULL
[project/mdnsd.git] / interface.c
index e98eddeb2467352a3c35c0fed68edbf499699893..ad25b39b984ad7d9b9e392da3db5a3f39bbcec89 100644 (file)
@@ -164,6 +164,7 @@ static struct interface *interface_lookup(unsigned int ifindex, enum umdns_socke
 
 static void interface_free(struct interface *iface)
 {
+       cache_cleanup(iface);
        announce_free(iface);
        free(iface->addrs.v4);
        free(iface);
@@ -464,6 +465,7 @@ iface_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
                        cache_cleanup(if_old);
                free(if_old->addrs.v4);
                if_old->addrs = if_new->addrs;
+               if_old->ifindex = if_new->ifindex;
                free(if_new);
                return;
        }
@@ -650,7 +652,8 @@ void interface_shutdown(void)
 
        vlist_for_each_element(&interfaces, iface, node)
                if (interface_multicast(iface)) {
-                       dns_reply_a(iface, NULL, 0);
+                       dns_reply_a(iface, NULL, 0, NULL);
+                       dns_reply_a_additional(iface, NULL, 0);
                        service_announce_services(iface, NULL, 0);
                }
 
@@ -669,4 +672,4 @@ struct interface *interface_get(const char *name, enum umdns_socket_type type)
        return iface;
 }
 
-VLIST_TREE(interfaces, avl_strcmp, iface_update_cb, false, false);
+VLIST_TREE(interfaces, avl_strcmp, iface_update_cb, true, false);