From 6f6830b700f33172e33db32f12e9bfef3a7f7989 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 6 Jan 2012 17:38:26 -0500 Subject: Remove ifconfig usage from assorted ancient device types. --- sysconfig/network-scripts/ifup-ctc | 7 ++++--- sysconfig/network-scripts/ifup-ippp | 11 +++++++---- sysconfig/network-scripts/ifup-plip | 12 ++++-------- sysconfig/network-scripts/ifup-plusb | 8 +++++--- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-ctc b/sysconfig/network-scripts/ifup-ctc index e268d7cc..1a1aec5d 100755 --- a/sysconfig/network-scripts/ifup-ctc +++ b/sysconfig/network-scripts/ifup-ctc @@ -23,10 +23,11 @@ if [ "$2" = "boot" -a "${ONBOOT}" = "no" ] then exit fi -[ -n "${MTU}" ] && opts="${opts} mtu ${MTU}" - -ifconfig ${DEVICE} ${IPADDR} ${opts} pointopoint ${GATEWAY} netmask ${NETMASK} +[ -n "${MTU}" ] && ip link set dev ${DEVICE} mtu ${MTU} +[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) +ip addr add ${IPADDR} peer ${GATEWAY}/${PREFIX} dev ${DEVICE} +ip link set up dev ${DEVICE} # Wait for the device to come up - the chandev'ified ctc driver can take # quite a while... timeout=0 diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp index 7cfe6f39..6ab69117 100755 --- a/sysconfig/network-scripts/ifup-ippp +++ b/sysconfig/network-scripts/ifup-ippp @@ -335,11 +335,14 @@ function addprovider() [ "$DEBUG" = "yes" ] && options="-d $options" # set netmask, if available - [ -n "$NETMASK" ] && netmask="netmask $NETMASK" - + [ -n "$NETMASK" ] && { + val=$(ipcalc --prefix $IPADDR $NETMASK) + pfx=${val##PREFIX=} + } # activate ISDN device - /usr/bin/logger -p daemon.info -t ifup-ippp "ifconfig $DEVICE $IPADDR pointopoint $GATEWAY $netmask up" - ifconfig $DEVICE $IPADDR pointopoint $GATEWAY $netmask up >/dev/null 2>&1 + /usr/bin/logger -p daemon.info -t ifup-ippp "ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE" + ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE + ip link set dev $DEVICE up if [ "$ENCAP" = "syncppp" ]; then # start ipppd daemon diff --git a/sysconfig/network-scripts/ifup-plip b/sysconfig/network-scripts/ifup-plip index 48bcc2ca..7f4f521e 100755 --- a/sysconfig/network-scripts/ifup-plip +++ b/sysconfig/network-scripts/ifup-plip @@ -11,14 +11,10 @@ then exit fi -ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} -route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE} - -# this is broken! it's only here to keep compatibility with old RH systems -if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ] -then - route add default gw ${GATEWAY} metric ${METRIC:-1} ${DEVICE} -fi +[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) +ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} dev ${DEVICE} +ip link set up dev ${DEVICE} +ip route add ${NETWORK} dev ${DEVICE} . /etc/sysconfig/network diff --git a/sysconfig/network-scripts/ifup-plusb b/sysconfig/network-scripts/ifup-plusb index e185e647..7f8f4649 100755 --- a/sysconfig/network-scripts/ifup-plusb +++ b/sysconfig/network-scripts/ifup-plusb @@ -22,12 +22,14 @@ then exit fi +[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) + if [ ${BROADCAST} != "" ] ; then - ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} netmask ${NETMASK} -broadcast ${BROADCAST} + ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} broadcast ${BROADCAST} dev ${DEVICE} else - ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} netmask ${NETMASK} + ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} dev ${DEVICE} fi +ip link set up dev ${DEVICE} . /etc/sysconfig/network -- cgit v1.2.1