- Silenced several other compiler warnings.
- Include the more standard sys/uio.h rather than rely upon other
- header files to include it (fixes a BSDI compile failure).
+ header files to include it (fixes a BSD 4.2 compile failure).
+
+- Duplicate dhclient-script updates for DHCPv6 to all provided scripts.
Changes since 3.1.0 (NEW FEATURES)
done
mv /etc/resolv.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
}
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
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
#!/bin/sh
#
-# $Id: freebsd,v 1.17 2006/07/22 02:24:16 dhankins Exp $
+# $Id: freebsd,v 1.18 2007/05/18 17:18:05 dhankins Exp $
#
# $FreeBSD$
$LOGGER "Error while writing new /etc/resolv.conf."
fi
fi
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+ ( cat /dev/null > /etc/resolv.conf.dhclient6 )
+ exit_status=$?
+ if [ $exit_status -ne 0 ] ; then
+ $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
+ else
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
+ ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
+ exit_status=$?
+ fi
+ for nameserver in ${new_dhcp6_name_servers} ; do
+ if [ $exit_status -ne 0 ] ; then
+ break
+ fi
+ ( echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 )
+ exit_status = $?
+ done
+
+ if [ $exit_status -ne 0 ] ; then
+ ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
+ exit_status = $?
+ fi
+
+ if [ $exit_status -ne 0 ] ; then
+ $LOGGER "Error while writing new /etc/resolv.conf."
+ fi
+ fi
fi
}
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
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 alias ${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 -alias ${old_ip6_address}/${old_ip6_prefixlen}
+
+ exit_with_hooks 0
+fi
+
exit_with_hooks 0
#!/bin/bash
-# dhclient-script for Linux. Dan Halbert, March, 1997.
-# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
-# Updated for ipv6 by David W. Hankins, Janurary 2007.
-
-ip=/sbin/ip
-
-make_resolv_conf() {
- if [ "x${new_dhcp6_name_servers}" != x ] ; then
- cat /dev/null > /etc/resolv.conf.dhclient
- chmod 644 /etc/resolv.conf.dhclient
-
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient
- fi
- for nameserver in ${new_dhcp6_name_servers} ; do
- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient
- done
-
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
- fi
-}
-
-# Check for valid constant input values.
-if [ x${reason} = x ] || [ x${interface} = x ] ; then
- exit 1;
-fi
-
-
-if [ ${reason} = PREINIT6 ] ; then
- # Ensure interface is up.
- ${ip} link set ${interface} up
-
- # Remove any stale addresses.
- ${ip} -f inet6 addr flush dev ${interface} scope global permanent
-
- exit 0
-fi
-
-
-if [ ${reason} = BOUND6 ] ; then
- if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
- exit 2;
- fi
-
- ${ip} -f inet6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
- dev ${interface} scope global
-
- # Check for nameserver options.
- make_resolv_conf
-
- exit 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 0
-fi
-
-
-if [ ${reason} = DEPREF6 ] ; then
- if [ x${new_ip6_prefixlen} = x ] ; then
- exit 2;
- fi
-
- # There doesn't appear to be a way to update an addr to indicate
- # preference.
-# ${ip} -f inet6 addr ??? ${new_ip6_address}/${new_ip6_prefixlen} \
-# dev ${interface} scope global deprecated?
-
- exit 0
-fi
-
-
-if [ ${reason} = EXPIRE6 ] ; then
- if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
- exit 2;
- fi
-
- ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
- dev ${interface}
-
- exit 0
-fi
-
-
-# Old DHCPv4 script below, need to review and reintegrate.
-
-exit
-
# dhclient-script for Linux. Dan Halbert, March, 1997.
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# No guarantees about this. I'm a novice at the details of Linux
# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
# of the $1 in its args.
+# 'ip' just looks too weird. /sbin/ip looks less weird.
+ip=/sbin/ip
+
make_resolv_conf() {
if [ x"$new_domain_name_servers" != x ]; then
cat /dev/null > /etc/resolv.conf.dhclient
done
mv /etc/resolv.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
}
relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
+###
+### DHCPv4 Handlers
+###
+
if [ x$new_broadcast_address != x ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
set $new_routers
- ############## what is -w in ping?
if ping -q -c 1 $1; then
if [ x$new_ip_address != x$alias_ip_address ] && \
[ x$alias_ip_address != x ]; then
exit_with_hooks 1
fi
+###
+### DHCPv6 Handlers
+###
+
+if [ ${reason} = PREINIT6 ] ; then
+ # Ensure interface is up.
+ ${ip} link set ${interface} up
+
+ # Remove any stale addresses from aborted clients.
+ ${ip} -f inet6 addr flush dev ${interface} scope global permanent
+
+ 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
+
+ ${ip} -f inet6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
+ dev ${interface} scope global
+
+ # 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
+
+ # There doesn't appear to be a way to update an addr to indicate
+ # preference.
+# ${ip} -f inet6 addr ??? ${new_ip6_address}/${new_ip6_prefixlen} \
+# dev ${interface} scope global deprecated?
+
+ 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
+
+ ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
+ dev ${interface}
+
+ exit_with_hooks 0
+fi
+
exit_with_hooks 0
done
mv /etc/resolv.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
}
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
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
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
}
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
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