]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.dns
Drop code for radvd
[people/ms/network.git] / src / functions / functions.dns
index de08c4c7aa592b553036ba5065ff4bb82c54524f..0e058be2779787bda3ef4a73f4ab5c63fa8a96f6 100644 (file)
@@ -31,8 +31,8 @@ NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_RANDOMIZE"
 DNS_SEARCH_DOMAINS=""
 NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_SEARCH_DOMAINS"
 
-# Set this option to true if the DNS servers should be advertised by
-# radvd.
+# Set this option to true if the DNS servers should be advertised in
+# IPv6 router advertisements
 DNS_ADVERTISE_SERVERS="true"
 
 DNS_SERVER_CONFIG_FILE="${NETWORK_CONFIG_DIR}/dns-servers"
@@ -187,6 +187,9 @@ dns_server_remove() {
 
 dns_server_flush() {
        : > ${DNS_SERVER_CONFIG_FILE}
+
+       # Re-generate resolv.conf
+       dns_generate_resolvconf
 }
 
 dns_server_parse_line() {
@@ -199,13 +202,13 @@ dns_server_parse_line() {
        while read -r arg; do
                case "${arg}" in
                        server=*)
-                               server=$(cli_get_val ${arg})
+                               server=$(cli_get_val "${arg}")
                                ;;
                        priority=*)
-                               priority=$(cli_get_val ${arg})
+                               priority=$(cli_get_val "${arg}")
                                ;;
                esac
-       done <<< "$(args $@)"
+       done <<< "$(args "$@")"
 
        # The server address must be set.
        isset server || return ${EXIT_ERROR}
@@ -225,8 +228,15 @@ dns_server_parse_line() {
        return ${EXIT_OK}
 }
 
-# Update resolv.conf(5) when initializing the network.
-init_register dns_generate_resolvconf
+# This function should be called after any configuration
+# changes have been made to the DNS servers.
+dns_server_update() {
+       # Regenerate /etc/resolv.conf
+       dns_generate_resolvconf
+
+       # Update bird about IPv6 DNS server changes
+       bird_update
+}
 
 dns_generate_resolvconf() {
        local file=${RESOLV_CONF}
@@ -235,6 +245,9 @@ dns_generate_resolvconf() {
 
        config_header "resolver configutation file" > ${file}
 
+       # Always enable EDNS0
+       print "option edns0\n" >> "${file}"
+
        if enabled DNS_RANDOMIZE; then
                print "option rotate\n" >> ${file}
        fi
@@ -276,6 +289,9 @@ dns_get_search_domains() {
                done
        done
 
+       # Add our own domain
+       list_append search_domains "$(config_domainname)"
+
        # Sort out duplicate entries.
        list_unique ${search_domains}
 }