aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown21
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp6
-rwxr-xr-xsysconfig/network-scripts/ifup28
-rwxr-xr-xsysconfig/network-scripts/ifup-ppp5
4 files changed, 48 insertions, 12 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 079d1ff5..ef8fe1cf 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -3,21 +3,34 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
cd /etc/sysconfig/network-scripts
+CONFIG=$1
+
+[ -z "$CONFIG" ] && {
+ echo "usage: ifdown <device name>" >&2
+ exit 1
+}
+
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+[ -f "$CONFIG" ] || {
+ echo "usage: ifdown <device name>" >&2
+ exit 1
+}
+
if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- exec /usr/sbin/usernetctl $1 down
+ exec /usr/sbin/usernetctl $CONFIG down
fi
echo "Users cannot control this device." >&2
exit 1
fi
-. $1
+. $CONFIG
DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"`
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}"
if [ -x $OTHERSCRIPT ]; then
- $OTHERSCRIPT $1 $2
+ $OTHERSCRIPT $CONFIG $2
exit $?
fi
@@ -38,5 +51,5 @@ fi
ifconfig ${DEVICE} down
-exec /etc/sysconfig/network-scripts/ifdown-post $1
+exec /etc/sysconfig/network-scripts/ifdown-post $CONFIG
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
index 31845640..84325ca6 100755
--- a/sysconfig/network-scripts/ifdown-ppp
+++ b/sysconfig/network-scripts/ifdown-ppp
@@ -23,7 +23,13 @@ if [ -z "$PID" ]; then
exit 1
fi
+# pppd might have chat as a child; remember chat's pid to kill after pppd.
+# (After, not before, so that pppd doesn't just restart it).
+
+CHATPID=`ps aul | awk '$4 ~ $PID {print $3}' 2>/dev/null`
+
kill $PID > /dev/null 2>&1
+[ -n "$CHATPID" ] && kill $CHATPID > /dev/null 2>&1
if [ ! -d /proc/$PID ]; then
/etc/sysconfig/network-scripts/ifdown-post $1
exit 0
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 76cdf379..ab1e6f7f 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -1,17 +1,30 @@
-#!/bin/sh
+#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin
cd /etc/sysconfig/network-scripts
+CONFIG=$1
+
+[ -z "$CONFIG" ] && {
+ echo "usage: ifup <device name>" >&2
+ exit 1
+}
+
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+[ -f "$CONFIG" ] || {
+ echo "usage: ifup <device name>" >&2
+ exit 1
+}
+
if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- exec /usr/sbin/usernetctl $1 up
+ exec /usr/sbin/usernetctl $CONFIG up
fi
echo "Users cannot control this device." >&2
exit 1
fi
-. $1
+. $CONFIG
if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]
then
@@ -55,7 +68,7 @@ fi
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}"
if [ -x $OTHERSCRIPT ]; then
- exec $OTHERSCRIPT $1 $2
+ exec $OTHERSCRIPT $CONFIG $2
fi
# is this device available? (this catches PCMCIA devices for us)
@@ -111,14 +124,15 @@ elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
fi
if [ "$IPSETUP" != yes ]; then
- ifconfig ${DEVICE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
+ ifconfig ${DEVICE} ${MACADDR:+hw ether $MACADDR} ${IPADDR} \
+ netmask ${NETMASK} broadcast ${BROADCAST}
if [ "$ISALIAS" = no ] ; then
route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE}
else
route add -host ${IPADDR} ${DEVICE}
fi
- # this is broken! it's only here for compatibility RH sytstems
+ # this is broken! it's only here for compatibility with old RH systems
if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ]; then
route add default gw ${GATEWAY} metric 1 ${DEVICE}
fi
@@ -155,4 +169,4 @@ if [ "$IPSETUP" != yes ]; then
fi
fi
-exec /etc/sysconfig/network-scripts/ifup-post $1
+exec /etc/sysconfig/network-scripts/ifup-post $CONFIG
diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp
index f1b5813f..7b5cb377 100755
--- a/sysconfig/network-scripts/ifup-ppp
+++ b/sysconfig/network-scripts/ifup-ppp
@@ -63,6 +63,9 @@ fi
if [ -n "${PAPNAME}" ] ; then
opts="$opts name ${PAPNAME}"
fi
+if [ -n "${DEBUG}" ] ; then
+ opts="$opts debug"
+fi
while : ; do
(logger -p daemon.info -t ifup-ppp \
@@ -72,7 +75,7 @@ while : ; do
/usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
remotename $DEVICE ipparam $DEVICE \
${PPPOPTIONS} \
- connect "/usr/sbin/chat -f /etc/sysconfig/network-scripts/chat-$DEVICE"
+ connect "/usr/sbin/chat ${DEBUG:+-v} -f /etc/sysconfig/network-scripts/chat-$DEVICE"
# exit if we're not supposed to persist or our lock file has disappeared
if [ "$PERSIST" != "yes" -o ! -f /var/run/ppp-$DEVICE.dev ]; then