2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 14:25:41 +00:00

- Duplicate dhclient-script updates for DHCPv6 to all provided scripts.

[ISC-Bugs #16875]
This commit is contained in:
David Hankins
2007-05-18 17:18:05 +00:00
parent 727cae264f
commit f66f02cc9c
6 changed files with 406 additions and 100 deletions

View File

@@ -16,6 +16,18 @@ make_resolv_conf() {
done
mv /etc/ersolv.conf.dhclient /etc/resolv.conf
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
cat /dev/null > /etc/resolv.conf.dhclient6
chmod 644 /etc/resolv.conf.dhclient6
if [ "x${new_dhcp6_domain_search}" != x ] ; then
echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
fi
for nameserver in ${new_dhcp6_name_servers} ; do
echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
done
mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
fi
}
@@ -68,6 +80,10 @@ if [ x$reason = xMEDIUM ]; then
exit_with_hooks 0
fi
###
### DHCPv4 Handlers
###
if [ x$reason = xPREINIT ]; then
if [ x$alias_ip_address != x ]; then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
@@ -213,4 +229,64 @@ if [ x$reason = xTIMEOUT ]; then
exit_with_hooks 1
fi
###
### DHCPv6 Handlers
###
if [ ${reason} = PREINIT6 ] ; then
# Ensure interface is up.
ifconfig ${interface} up
# XXX: Remove any stale addresses from aborted clients.
exit_with_hooks 0
fi
if [ ${reason} = BOUND6 ] ; then
if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
exit_with_hooks 2;
fi
ifconfig ${interface} inet6 add ${new_ip6_address}/${new_ip6_prefixlen}
# Check for nameserver options.
make_resolv_conf
exit_with_hooks 0
fi
if [ ${reason} = RENEW6 ] || [ ${reason} = REBIND6 ] ; then
# Make sure nothing has moved around on us.
# Nameservers/domains/etc.
if [ "x${new_dhcp6_name_servers}" != "x${old_dhcp6_name_servers}" ] ||
[ "x${new_dhcp6_domain_search}" != "x${old_dhcp6_domain_search}" ] ; then
make_resolv_conf
fi
exit_with_hooks 0
fi
if [ ${reason} = DEPREF6 ] ; then
if [ x${new_ip6_prefixlen} = x ] ; then
exit_with_hooks 2;
fi
# XXX:
# There doesn't appear to be a way to update an addr to indicate
# preference.
exit_with_hooks 0
fi
if [ ${reason} = EXPIRE6 ] ; then
if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
exit_with_hooks 2;
fi
ifconfig ${interface} inet6 delete ${old_ip6_address}/${old_ip6_prefixlen}
exit_with_hooks 0
fi
exit_with_hooks 0