From: Roy Marples Date: Thu, 15 Dec 2011 03:02:46 +0000 (+0000) Subject: Hook the new RA options into resolv.conf X-Git-Tag: v5.5.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb84865096a47b4e16f2e83cc59860fd5c722cc7;p=thirdparty%2Fdhcpcd.git Hook the new RA options into resolv.conf --- diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 73ae92a7..13af0d59 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -12,7 +12,7 @@ NL=" build_resolv_conf() { - local cf="$state_dir/resolv.conf.$interface" + local cf="$state_dir/resolv.conf.$interface$ifsuffix" local interfaces= header= search= srvs= servers= x= # Build a list of interfaces @@ -71,7 +71,15 @@ build_resolv_conf() add_resolv_conf() { - local x= conf="$signature$NL" + local x= conf="$signature$NL" i=${new_ra_count:-0} ra= + + while [ $i -ne 0 ]; do + eval ra=\$new_ra${i}_rdnss + new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$ra" + eval ra=\$new_ra${i}_dnssl + new_domain_search="$new_domain_search${new_domain_search:+ }$ra" + i=$(($i - 1)) + done # If we don't have any configuration, remove it if [ -z "$new_domain_name_servers" -a \ @@ -106,30 +114,36 @@ add_resolv_conf() done if type resolvconf >/dev/null 2>&1; then [ -n "$ifmetric" ] && export IF_METRIC="$ifmetric" - printf %s "$conf" | resolvconf -a "$interface" + printf %s "$conf" | resolvconf -a "$interface$ifsuffix" return $? fi - if [ -e "$resolv_conf_dir/$interface" ]; then - rm -f "$resolv_conf_dir/$interface" + if [ -e "$resolv_conf_dir/$interface$ifsuffix" ]; then + rm -f "$resolv_conf_dir/$interface$ifsuffix" fi [ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir" - printf %s "$conf" > "$resolv_conf_dir/$interface" + printf %s "$conf" > "$resolv_conf_dir/$interface$ifsuffix" build_resolv_conf } remove_resolv_conf() { if type resolvconf >/dev/null 2>&1; then - resolvconf -d "$interface" -f + resolvconf -d "$interface$ifsuffix" -f else - if [ -e "$resolv_conf_dir/$interface" ]; then - rm -f "$resolv_conf_dir/$interface" + if [ -e "$resolv_conf_dir/$interface$ifsuffix" ]; then + rm -f "$resolv_conf_dir/$interface$ifsuffix" fi build_resolv_conf fi } +if [ "$reason" = ROUTERADVERT ]; then + ifsuffix=":ra" +else + ifsuffix= +fi + if $if_up; then add_resolv_conf elif $if_down; then