+static void
+hostname_update(struct vlist_tree *tree, struct vlist_node *node_new,
+ struct vlist_node *node_old)
+{
+ struct interface *iface;
+ struct hostname *h;
+
+ if (!node_old) {
+ h = container_of(node_new, struct hostname, node);
+ vlist_for_each_element(&interfaces, iface, node)
+ dns_reply_a(iface, NULL, announce_ttl, h->hostname);
+ return;
+ }
+
+ h = container_of(node_old, struct hostname, node);
+ if (!node_new)
+ vlist_for_each_element(&interfaces, iface, node)
+ dns_reply_a(iface, NULL, 0, h->hostname);
+
+ free(h);
+}
+
+static void
+service_load_hostname(struct blob_attr *b)
+{
+ struct hostname *h;
+ char *hostname, *d_hostname;
+
+ hostname = blobmsg_get_string(b);
+ h = calloc_a(sizeof(*h), &d_hostname, strlen(hostname) + 1);
+ if (!h)
+ return;
+
+ h->hostname = strcpy(d_hostname, hostname);
+
+ vlist_add(&hostnames, &h->node, h->hostname);
+}
+