SOURCES: dhcp-dhclient.script.patch - updated to 4.0.0; handle ipv...
arekm
arekm at pld-linux.org
Sun Feb 3 20:12:17 CET 2008
Author: arekm Date: Sun Feb 3 19:12:17 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- updated to 4.0.0; handle ipv6, too
---- Files affected:
SOURCES:
dhcp-dhclient.script.patch (1.2 -> 1.3)
---- Diffs:
================================================================
Index: SOURCES/dhcp-dhclient.script.patch
diff -u SOURCES/dhcp-dhclient.script.patch:1.2 SOURCES/dhcp-dhclient.script.patch:1.3
--- SOURCES/dhcp-dhclient.script.patch:1.2 Mon Apr 16 18:19:35 2007
+++ SOURCES/dhcp-dhclient.script.patch Sun Feb 3 20:12:12 2008
@@ -1,6 +1,6 @@
--- dhcp-3.1.0a3/client/scripts/linux.orig 2006-07-22 04:24:16.000000000 +0200
+++ dhcp-3.1.0a3/client/scripts/linux 2007-04-16 17:25:06.000000000 +0200
-@@ -1,208 +1,227 @@
+@@ -1,290 +1,302 @@
-#!/bin/bash
+#!/bin/sh
# dhclient-script for Linux. Dan Halbert, March, 1997.
@@ -26,6 +26,9 @@
-
-# 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
+calc_prefix()
+{
+ local old_IFS=$IFS
@@ -69,6 +72,18 @@
- 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
+ if [ -n "$new_domain_name_servers" ]; then
+ :> /etc/resolv.conf.dhclient
@@ -85,6 +100,17 @@
+ echo nameserver $nameserver >>/etc/resolv.conf.dhclient
+ done
+ mv /etc/resolv.conf.dhclient /etc/resolv.conf
++ elif [ -n "${new_dhcp6_name_servers}" ] ; then
++ :> /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
}
@@ -115,13 +141,24 @@
- if [ $exit_status -ne 0 ]; then
- exit $exit_status
- fi
--fi
--
++ exit_status=0
++ . /etc/dhclient-enter-hooks
++ # allow the local script to abort processing of this state
++ # local script must set exit_status variable to nonzero.
++ if [ $exit_status -ne 0 ]; then
++ exit $exit_status
++ fi
+ fi
+
-release=`uname -r`
-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
@@ -229,7 +266,9 @@
- route add -host $alias_ip_address $interface:0
- fi
- exit_with_hooks 0
--fi
++if [ -n "$new_broadcast_address" ]; then
++ new_broadcast_arg="broadcast $new_broadcast_address"
+ fi
-
-if [ x$reason = xTIMEOUT ]; then
- if [ x$alias_ip_address != x ]; then
@@ -238,7 +277,6 @@
- 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
@@ -257,25 +295,25 @@
- fi
- ifconfig $interface inet 0 down
- exit_with_hooks 1
--fi
-+ exit_status=0
-+ . /etc/dhclient-enter-hooks
-+ # allow the local script to abort processing of this state
-+ # local script must set exit_status variable to nonzero.
-+ if [ $exit_status -ne 0 ]; then
-+ exit $exit_status
-+ fi
-+fi
-+
-+if [ -n "$new_broadcast_address" ]; then
-+ new_broadcast_arg="broadcast $new_broadcast_address"
-+fi
+if [ -n "$old_broadcast_address" ]; then
+ old_broadcast_arg="broadcast $old_broadcast_address"
-+fi
+ 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
+if [ -n "$new_subnet_mask" ]; then
+ new_subnet_arg="$(calc_prefix $new_subnet_mask)"
-+fi
+ fi
+if [ -n "$old_subnet_mask" ]; then
+ old_subnet_arg="$(calc_prefix $old_subnet_mask)"
+fi
@@ -412,6 +450,107 @@
+ fi
+ exit_with_hooks 1
+ ;;
++
++ PREINIT6)
++ # Ensure interface is up.
++ /sbin/ip link set ${interface} up
++
++ # Remove any stale addresses from aborted clients.
++ /sbin/ip -f inet6 addr flush dev ${interface} scope global permanent
++
++ exit_with_hooks 0
++ ;;
++ BOUND6)
++ if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
++ exit_with_hooks 2;
++ 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} \
++ /sbin/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
++ # Check for nameserver options.
++ make_resolv_conf
+
+-if [ ${reason} = RENEW6 ] || [ ${reason} = REBIND6 ] ; then
+- # Make sure nothing has moved around on us.
++ exit_with_hooks 0
++ ;;
+
+- # 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
++ RENEW6|REBIND6)
++ # Make sure nothing has moved around on us.
+
+-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?
++ # 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
++ ;;
++
++ DEPREF6)
++ 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.
++ # /sbin/ip -f inet6 addr ??? ${new_ip6_address}/${new_ip6_prefixlen} \
++ # dev ${interface} scope global deprecated?
++
++ exit_with_hooks 0
++ ;;
++
++ EXPIRE6|RELEASE6|STOP6)
++ if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
++ exit_with_hooks 2;
++ fi
+
+- exit_with_hooks 0
+-fi
+-
+-if [ ${reason} = EXPIRE6 -o ${reason} = RELEASE6 -o ${reason} = STOP6 ] ; 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} \
++ /sbin/ip -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
+ dev ${interface}
+
+- exit_with_hooks 0
+-fi
++ exit_with_hooks 0
++ ;;
++
+ *)
+ ;;
+esac
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/dhcp-dhclient.script.patch?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list