Browse Source

print-dhcpv6-info: Actually apply IPv6 address and resolv.conf entries received from the DHCPv6 server

Rebased-and-modified-by: Philipp Kern <pkern@debian.org>
tags/1.90
Colin Watson Philipp Kern 9 years ago
parent
commit
ee23b2c57c
1 changed files with 31 additions and 0 deletions
  1. +31
    -0
      print-dhcpv6-info

+ 31
- 0
print-dhcpv6-info View File

@@ -10,6 +10,37 @@ case $reason in
;;
esac

# update /etc/resolv.conf based on received values
make_resolv_conf() {
local new_resolv_conf

if [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
new_resolv_conf=/etc/resolv.conf.dhclient-new
rm -f $new_resolv_conf

if [ -n "$new_dhcp6_domain_search" ]; then
echo "search $new_dhcp6_domain_search" >> $new_resolv_conf
fi

if [ -n "$new_dhcp6_name_servers" ]; then
for nameserver in $new_dhcp6_name_servers; do
echo "nameserver $nameserver" >> $new_resolv_conf
done
else # keep 'old' nameservers
grep -i '^nameserver' /etc/resolv.conf >> $new_resolv_conf
fi

mv $new_resolv_conf /etc/resolv.conf
fi
}

if [ "$new_ip6_address" ] && [ "$new_ip6_prefixlen" ]; then
ip -6 addr add $new_ip6_address/$new_ip6_prefixlen \
dev $interface scope global
fi

make_resolv_conf

i=0
for srv in $new_dhcp6_name_servers; do
echo "nameserver[$i] $srv"


Loading…
Cancel
Save