]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Duplicate dhclient-script updates for DHCPv6 to all provided scripts.
authorDavid Hankins <dhankins@isc.org>
Fri, 18 May 2007 17:18:05 +0000 (17:18 +0000)
committerDavid Hankins <dhankins@isc.org>
Fri, 18 May 2007 17:18:05 +0000 (17:18 +0000)
  [ISC-Bugs #16875]

RELNOTES
client/scripts/bsdos
client/scripts/freebsd
client/scripts/linux
client/scripts/netbsd
client/scripts/openbsd

index 21399a409d17253e4bd4f5ede08e85567f4329b9..69a524960efdb641af9f73387ba6ecb71a4d7b4f 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -63,7 +63,9 @@ the README file.
 - 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)
 
index fb0d43f22510d322367aa409a13bc1ed516aa56d..de3b18d78860d5918b18315e53b544622687b7f9 100755 (executable)
@@ -16,6 +16,18 @@ make_resolv_conf() {
     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
 }
 
@@ -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
index b40316eb1a7a0e5bc2811186a0dff659aa57afee..b4567a50c317f0a41f35a544292663bb8ef53930 100755 (executable)
@@ -1,6 +1,6 @@
 #!/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$
 
@@ -45,6 +45,33 @@ make_resolv_conf() {
        $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
 }
 
@@ -97,6 +124,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
@@ -253,4 +284,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 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
index 72e37ee15f4479a0545dafac908991b1a719e665..ee3ef42d6e8d202aab0c74272d208fd8d83bab8f 100755 (executable)
@@ -1,101 +1,4 @@
 #!/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
@@ -119,6 +22,9 @@ exit
 # 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
@@ -136,6 +42,18 @@ make_resolv_conf() {
     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
 }
 
@@ -165,6 +83,10 @@ release=`expr $release : '\(.*\)\..*'`
 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
@@ -281,7 +203,6 @@ if [ x$reason = xTIMEOUT ]; then
   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
@@ -302,4 +223,68 @@ if [ x$reason = xTIMEOUT ]; 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
index 3de6b555d72e167e838bd0153bea3078b8675b2f..5629ee785de1d122c8423e4fd0f381d1aa7b1946 100755 (executable)
@@ -16,6 +16,18 @@ make_resolv_conf() {
     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
 }
 
@@ -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
index 64fead2e2fcc989d3338561d589c1a588f238fab..a17a0a451fe27909fbb1e9f9fa3fb293638b8564 100644 (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