aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifdown-eth
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/ifdown-eth')
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth36
1 files changed, 27 insertions, 9 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth
index 684cef73..56ea2725 100755
--- a/sysconfig/network-scripts/ifdown-eth
+++ b/sysconfig/network-scripts/ifdown-eth
@@ -56,7 +56,7 @@ fi
fi
if is_bonding_device ${DEVICE} ; then
- for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?" /etc/sysconfig/network-scripts/ifcfg-*) ; do
+ for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do
is_ignored_file "$device" && continue
/sbin/ifdown ${device##*/}
done
@@ -88,7 +88,29 @@ if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -f /var/run/dhcp6c_${DEVICE}.pid ]; then
rm -f /var/run/dhcp6c_${DEVICE}.pid;
fi
-# Kill running dhcp client if present
+retcode=0
+[ -n "$(pidof -x dhclient)" ] && {
+ for VER in "" 6 ; do
+ if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
+ dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid)
+ generate_lease_file_name $VER
+ if [[ "$DHCPRELEASE" = [yY1]* ]]; then
+ /sbin/dhclient -r -lf ${LEASEFILE} -pf /var/run/dhclient$VER-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1
+ retcode=$?
+ else
+ kill $dhcpid >/dev/null 2>&1
+ retcode=$?
+ reason=STOP$VER interface=${DEVICE} /sbin/dhclient-script
+ fi
+ if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
+ rm -f /var/run/dhclient$VER-${DEVICE}.pid
+ kill $dhcpid >/dev/null 2>&1
+ fi
+ fi
+ done
+}
+
+# Kill running dhcp client if present (supports more clients than the above)
dhcp_client_pids() {
CLIENTS='dhcpcd|pump|dhcpxd|dhclient|zcip'
[ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ] && CLIENTS="${CLIENTS}|wpa_supplicant"
@@ -100,7 +122,6 @@ if [ -n "${daemon}" -a "$MII_NOT_SUPPORTED" != "yes" ]; then
/sbin/ifplugd -k -W -i ${DEVICE}
fi
-retcode=0
pids=`dhcp_client_pids`
if [ -n "$pids" ]; then
kill $pids
@@ -140,12 +161,12 @@ fi
if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
/sbin/ip link set dev ${DEVICE} down
- /usr/sbin/brctl delif ${BRIDGE} ${DEVICE}
+ /usr/sbin/brctl delif -- ${BRIDGE} ${DEVICE}
# Upon removing a device from a bridge,
# it's necessary to make radvd reload its config
[ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid)
if [ -d /sys/class/net/${BRIDGE}/brif ] && [ $(ls -1 /sys/class/net/${BRIDGE}/brif | wc -l) -eq 0 ]; then
- /usr/sbin/brctl delbr ${BRIDGE}
+ /usr/sbin/brctl delbr -- ${BRIDGE}
fi
fi
@@ -173,11 +194,8 @@ fi
if [ -n "$VLAN" ]; then
# 802.1q VLAN
- if echo ${DEVICE} | LANG=C grep -Ev '(:)' | LANG=C grep -Eq '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' \
- || echo ${DEVICE} | LANG=C grep -Eq 'vlan[0-9][0-9]?[0-9]?[0-9]?' ; then
- [ -f /proc/net/vlan/${DEVICE} ] && {
+ if [ -f /proc/net/vlan/${DEVICE} ]; then
ip link delete ${DEVICE} type vlan
- }
fi
fi