move dns server/search list parsing to interface core to support peerdns=0 + static...
[project/netifd.git] / interface-ip.c
index ed68116..3b545ca 100644 (file)
@@ -1,3 +1,16 @@
+/*
+ * netifd - network interface daemon
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -476,7 +489,8 @@ interface_write_resolv_conf(void)
 
                fprintf(f, "# Interface %s\n", iface->name);
                write_resolv_conf_entries(f, &iface->config_ip);
-               write_resolv_conf_entries(f, &iface->proto_ip);
+               if (!iface->proto_ip.no_dns)
+                       write_resolv_conf_entries(f, &iface->proto_ip);
        }
        fclose(f);
        if (rename(path, resolv_conf) < 0) {
@@ -530,8 +544,10 @@ void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled)
 void
 interface_ip_update_start(struct interface_ip_settings *ip)
 {
-       vlist_simple_update(&ip->dns_servers);
-       vlist_simple_update(&ip->dns_search);
+       if (ip != &ip->iface->config_ip) {
+               vlist_simple_update(&ip->dns_servers);
+               vlist_simple_update(&ip->dns_search);
+       }
        vlist_update(&ip->route);
        vlist_update(&ip->addr);
 }