#!/bin/sh
#
-# $Id: ifup-sl,v 1.17 2000/09/19 12:46:45 saq Exp $
+# $Id: ifup-sl,v 1.18 2001/05/15 16:03:44 baggins Exp $
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
# ifup-post can't be done for slip :-( Solution: use PPP
+. /etc/sysconfig/network
+. /etc/rc.d/init.d/functions
+. /etc/sysconfig/network-scripts/.functions
+
# become a daemon in case we have to persist.
if [ "$1" != daemon ] ; then
# disconnect stdin, out, err to disassociate from controlling tty
fi
shift
-. /etc/rc.d/init.d/functions
-. /etc/sysconfig/network-scripts/.functions
-
CONFIG=$1
source_config
exit
fi
+# set all major variables
+setup_ip_param
+
if [ -z "$RETRYTIMEOUT" ]; then
RETRYTIMEOUT=30
fi
# Try to load slip module
-if [ "`ls -R /lib/modules/\`uname -r\`/ | grep slip.o`" != "" ]; then
+if is_module "slip"; then
/sbin/modprobe -s -k slip
fi
[ -x /usr/sbin/dip ] || {
nls "/usr/sbin/dip does not exist or is not executable"
- nls "ifup-sl for $DEVICE exiting"
+ nls "ifup-sl for %s exiting" "$DEVICE"
logger -p daemon.info -t ifup-sl \
- "`nls '/usr/sbin/dip does not exist or is not executable for %s' $DEVICE`"
+ "`nls '/usr/sbin/dip does not exist or is not executable for'` $DEVICE"
exit 1
}
DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$PARENTDEVNAME
}
[ -f $DIPSCRIPT ] || {
- echo "/etc/sysconfig/interfaces/data/dip-$DEVICE `nls 'does not exist'`"
+ echo "/etc/sysconfig/interfaces/data/dip-$DEVICE $(nls 'does not exist')"
echo "ifup-sl for $DEVICE exiting"
logger -p daemon.info -t ifup-sl \
- "/etc/sysconfig/interfaces/data/dip-$DEVICE `nls 'does not exist for %s' $DEVICE`"
+ "/etc/sysconfig/interfaces/data/dip-$DEVICE $(nls 'does not exist for') $DEVICE"
exit 1
}
while : ; do
echo > /var/run/sl-$DEVICE.dev
(logger -p daemon.info -t ifup-sl \
- "`nls 'dip started for %s on %s at %s' $DEVICE $MODEMPORT $LINESPEED`" &)&
+ "$(nls 'dip started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)&
doexec /usr/sbin/dip dip-$DEVICE $DIPSCRIPT
if is_no "$PERSIST" || [ ! -f /var/run/sl-$DEVICE.dev ] ; then
exit 0
[ -z "$PROTOCOL" ] && PROTOCOL=slip
[ -x /sbin/slattach ] || {
- nls "/sbin/slattach does not exist or is not executable"
- echo "ifup-sl - $DEVICE `nls exiting`"
+ nls "%s is missing. Can't continue." "/sbin/slattach"
+ echo "ifup-sl - $DEVICE $(nls exiting)"
logger -p daemon.info -t ifup-sl \
- "`nls '/sbin/slattach does not exist or is not executable for %s' $DEVICE`"
+ "$(nls '/sbin/slattach does not exist or is not executable for %s' "$DEVICE")"
exit 1
}
echo > /var/run/sl-$DEVICE.dev
(logger -p daemon.info -t ifup-sl \
- "`nls 'slattach started for %s on %s at %s' $DEVICE $MODEMPORT $LINESPEED`" &)&
+ "$(nls 'slattach started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)&
slattach -p $PROTOCOL -s $LINESPEED $MODEMPORT &
usleep 1500
+
+ if is_yes "$IPV4_NETWORKING"; then
+ if [ -n "$IP4ADDR" -a -n "$REMIP" ]; then
+ # Peer is only for IPv4
+ ip -4 addr add $IP4ADDR peer $REMIP dev $DEVICE
+ fi
+ fi
+
+ if is_yes "$IPV6_NETWORKING"; then
+ if [ -n "$IP6ADDR" ]; then
+ ip -6 addr add $IP6ADDR dev $DEVICE
+ fi
+ fi
+
ip link set $DEVICE mtu $MTU up
- ip -family inet addr add $IPADDR peer $REMIP dev $DEVICE
- # Set defaultroute
- if is_yes "$DEFROUTE"; then
- ip -family inet route add default dev $DEVICE
- fi
+ # IPv4/6 gateways and default routes
+ setup_ip_gw_ro
+
+ /etc/sysconfig/network-scripts/ifup-post $1
fi
+
+# This must be last line !
+# vi:syntax=sh:tw=78:ts=8:sw=4