diff options
-rwxr-xr-x | sysconfig/network-scripts/ifdown-eth | 11 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup | 9 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 13 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 26 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions-ipv6 | 30 |
5 files changed, 44 insertions, 45 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index a9570c01..83aa7c7a 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -58,19 +58,12 @@ fi; retcode=0 [ -n "`pidof -x dhclient`" ] && { if [ -f "/var/run/dhclient-${DEVICE}.pid" ]; then - dhcpid=`cat /var/run/dhclient-${DEVICE}.pid` if [[ "$DHCPRELEASE" = [yY1]* ]]; then - /sbin/dhclient -r -lf /var/lib/dhcp/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1 + release_dhcp_lease retcode=$? else - kill $dhcpid >/dev/null 2>&1 - retcode=$? - reason=STOP interface=${DEVICE} /sbin/dhclient-script + kill_dhcp_client fi - if [ -f "/var/run/dhclient-${DEVICE}.pid" ]; then - rm -f /var/run/dhclient-${DEVICE}.pid - kill $dhcpid >/dev/null 2>&1 - fi fi } # we can't just delete the configured address because that address diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index fc4d9a32..57163f09 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -119,15 +119,6 @@ if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then fi fi -# Old BOOTP variable -if [ "${BOOTP}" = "yes" ]; then - BOOTPROTO=bootp -fi - -if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then - DYNCONFIG=true -fi - if [ -x /sbin/ifup-pre-local ]; then /sbin/ifup-pre-local ${CONFIG} $2 fi diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index b488d272..393a966e 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -22,15 +22,6 @@ need_config ${CONFIG} source_config -# Old BOOTP variable -if [ "${BOOTP}" = "yes" ]; then - BOOTPROTO=bootp -fi - -if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then - DYNCONFIG=true -fi - # load the module associated with that device # /sbin/modprobe ${REALDEVICE} is_available ${REALDEVICE} @@ -143,7 +134,7 @@ if [ -w /etc/dhclient-${DEVICE}.conf ] && [ -x /sbin/dhclient ] ; then rm -f /etc/dhclient-${DEVICE}.conf.ifupnew fi -if [ -n "${DYNCONFIG}" ]; then +if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then PUMPARGS=$PUMPARGS DHCPCDARGS="$DHCPCDARGS -n" if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then @@ -203,6 +194,8 @@ if [ -n "${DYNCONFIG}" ]; then FWHACK=1 fi + release_dhcp_lease + if [ -x /sbin/dhclient ] && /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then echo $" done." else diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 5bfb4724..f59cf8d7 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -393,3 +393,29 @@ change_resolv_conf () fi; return $r; } + + +kill_dhcp_client () +{ + pid=`cat /var/run/dhclient-${DEVICE}.pid` + kill $pid >/dev/null 2>&1 + rc=$? + reason=STOP interface=${DEVICE} /sbin/dhclient-script + if [ -f "/var/run/dhclient-${DEVICE}.pid" ]; then + rm -f /var/run/dhclient-${DEVICE}.pid + kill -9 $pid >/dev/null 2>&1 + fi + return $rc +} + +release_dhcp_lease () +{ + /sbin/dhclient -r -lf /var/lib/dhcp/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1 + rc=$? + if [ -f "/var/run/dhclient-${DEVICE}.pid" ]; then + rm -f /var/run/dhclient-${DEVICE}.pid + kill -9 $pid >/dev/null 2>&1 + fi + return $rc +} + diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6 index fb04ed83..944577ec 100644 --- a/sysconfig/network-scripts/network-functions-ipv6 +++ b/sysconfig/network-scripts/network-functions-ipv6 @@ -8,7 +8,7 @@ # You will find more information on the initscripts-ipv6 homepage at # http://www.deepspace6.net/projects/initscripts-ipv6.html # -# Version: 2005-01-07 +# Version: 2005-03-03 # # @@ -597,11 +597,13 @@ ipv6_cleanup_device() { # Remove all IPv6 routes through this device (but not "lo") if [ "$device" != "lo" ]; then - ipv6_exec_ip -6 route flush dev $device >/dev/null 2>&1 + ipv6_exec_ip -6 route flush dev $device scope global >/dev/null 2>&1 + ipv6_exec_ip -6 route flush dev $device scope site >/dev/null 2>&1 fi # Remove all IPv6 addresses on this interface - ipv6_exec_ip -6 addr flush dev $device >/dev/null 2>&1 + ipv6_exec_ip -6 addr flush dev $device scope global >/dev/null 2>&1 + ipv6_exec_ip -6 addr flush dev $device scope site >/dev/null 2>&1 return 0 } @@ -1075,24 +1077,18 @@ ipv6_add_tunnel_device() { local ttldefault=64 fi - # Test whether remote IPv4 address was already applied to another tunnel (does not catch IPv4 addresses with leading 0's) - ipv6_exec_ip tunnel show 2>/dev/null | LC_ALL=C grep -w "ipv6/ip" | LC_ALL=C grep "$addressipv4tunnel" | while read dev type tag remote tag local tag ttl rest; do - local devnew="`echo $dev | sed 's/:$//g'`" - if [ "$remote" = "$addressipv4tunnel" ]; then - ipv6_log $"Given remote address '$addressipv4tunnel' on tunnel device '$device' is already configured on device '$devnew'" err $fn - return 3 - fi - done - if [ $? -ne 0 ]; then - return 3 + # Test whether remote IPv4 address was already applied to another tunnel + if [ "$addressipv4tunnel" != "0.0.0.0" -a "$addressipv4tunnel" != "any" ]; then + ipv6_exec_ip tunnel show remote $addressipv4tunnel 2>/dev/null | LC_ALL=C grep -w "ipv6/ip" | while IFS=":" read devnew rest; do + if [ "$devnew" != "$device" ]; then + ipv6_log $"Given remote address '$addressipv4tunnel' on tunnel device '$device' is already configured on device '$devnew'" err $fn + return 3 + fi + done fi ipv6_exec_ip tunnel add $device mode sit ttl $ttldefault remote $addressipv4tunnel local $addressipv4tunnellocal - - # Test, whether "ip tunnel show" works without error - ipv6_exec_ip tunnel show $device >/dev/null 2>&1 if [ $? -ne 0 ]; then - ipv6_log $"Tunnel device '$device' creation didn't work" err $fn return 3 fi |