aboutsummaryrefslogtreecommitdiffstats
path: root/network-scripts/ifdown-post
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2018-05-25 20:01:54 +0200
committerDee'Kej <deekej@linuxmail.org>2018-05-30 12:32:22 +0200
commita145ddda284570e57413e37f025c3657205e17d8 (patch)
treea371338da02e38d8745964f75239c8ee62cc459b /network-scripts/ifdown-post
parentdb1ca2fadd20d0a4fb5a0fe18adcd8c960db9cf3 (diff)
downloadinitscripts-a145ddda284570e57413e37f025c3657205e17d8.tar
initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar.gz
initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar.bz2
initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar.xz
initscripts-a145ddda284570e57413e37f025c3657205e17d8.zip
Repository scheme updated to new layout
NOTE: This commit just moves files around, without actually fixing the Makefiles and specfile. See follow up commits which resolve this.
Diffstat (limited to 'network-scripts/ifdown-post')
-rwxr-xr-xnetwork-scripts/ifdown-post72
1 files changed, 72 insertions, 0 deletions
diff --git a/network-scripts/ifdown-post b/network-scripts/ifdown-post
new file mode 100755
index 00000000..9db16ad3
--- /dev/null
+++ b/network-scripts/ifdown-post
@@ -0,0 +1,72 @@
+#!/bin/sh
+# This should be called whenever an interface goes down, not just when
+# it is brought down explicitly.
+
+cd /etc/sysconfig/network-scripts
+. ./network-functions
+
+unset REALDEVICE
+if [ "$1" = --realdevice ] ; then
+ REALDEVICE=$2
+ shift 2
+fi
+
+CONFIG=$1
+source_config
+
+[ -z "$REALDEVICE" ] && REALDEVICE=$DEVICE
+
+/etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} ${DEVNAME}
+
+# Remove duplicate DNS entries and shift them,
+# to have always correct condition below...
+update_DNS_entries
+
+if ! is_false "${PEERDNS}" || is_true "${RESOLV_MODS}" && \
+ [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" -o -n "${DNS1}" \
+ -o "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ] ; then
+ if [ -f /etc/resolv.conf.save ]; then
+ change_resolv_conf /etc/resolv.conf.save
+ rm -f /etc/resolv.conf.save
+ fi
+ if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
+ if [ -f /etc/ppp/peers/$DEVICE ] ; then
+ rm -f /etc/ppp/peers/$DEVICE
+ fi
+ fi
+fi
+
+# Reset the default route if this interface had a special one
+if ! check_default_route ; then
+ # ISDN device needs special handling dial on demand
+ if [ "${DEVICETYPE}" = "ippp" -o "${DEVICETYPE}" = "isdn" ] && \
+ [ "$DIALMODE" = "auto" ] ; then
+ if [ -z "$GATEWAY" ] ; then
+ /sbin/ip route add default ${METRIC:+metric} \
+ ${WINDOW:+window $WINDOW} dev ${DEVICE}
+ else
+ /sbin/ip route add default ${METRIC:+metric} \
+ ${WINDOW:+window $WINDOW} via ${GATEWAY}
+ fi
+ else
+ add_default_route ${DEVICE}
+ fi
+fi
+
+# Reset firewall ZONE to "default":
+if [ "${REALDEVICE}" != "lo" ]; then
+ dbus-send --system --dest=org.fedoraproject.FirewallD1 \
+ /org/fedoraproject/FirewallD1 \
+ org.fedoraproject.FirewallD1.zone.removeInterface \
+ string: "" string:"${DEVICE}" \
+ > /dev/null 2>&1
+fi
+
+# Notify programs that have requested notification
+do_netreport
+
+if [ -x /sbin/ifdown-local ]; then
+ /sbin/ifdown-local ${DEVICE}
+fi
+
+exit 0