+ if (list_empty(&iface->proto_dns_search) &&
+ list_empty(&iface->proto_dns_servers))
+ continue;
+
+ fprintf(f, "# Interface %s\n", iface->name);
+ list_for_each_entry(s, &iface->proto_dns_servers, list) {
+ str = inet_ntop(s->af, &s->addr, buf, sizeof(buf));
+ if (!str)
+ continue;
+
+ fprintf(f, "nameserver %s\n", str);
+ }
+
+ list_for_each_entry(d, &iface->proto_dns_search, list) {
+ fprintf(f, "search %s\n", d->name);
+ }
+ }
+ fclose(f);
+ if (rename(path, resolv_conf) < 0) {
+ D(INTERFACE, "Failed to replace %s\n", resolv_conf);
+ unlink(path);
+ }
+}
+
+void
+interface_ip_update_start(struct interface *iface)
+{
+ interface_clear_dns(iface);
+ vlist_update(&iface->proto_route);
+ vlist_update(&iface->proto_addr);
+}
+
+void
+interface_ip_update_complete(struct interface *iface)
+{
+ vlist_flush(&iface->proto_route);
+ vlist_flush(&iface->proto_addr);
+}
+
+void
+interface_ip_init(struct interface *iface)
+{
+ vlist_init(&iface->proto_route, route_cmp, interface_update_proto_route,
+ struct device_route, node, mask);
+ vlist_init(&iface->proto_addr, addr_cmp, interface_update_proto_addr,
+ struct device_addr, node, mask);