]> git.pld-linux.org Git - projects/rc-scripts.git/blame - sysconfig/network-scripts/ifup-sl
- add support for running inside vservers, the diff may seem huge but it's
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-sl
CommitLineData
12de71be 1#!/bin/sh
b0443108 2#
ec8b15cb 3# $Id$
b0443108 4#
7742e157
AF
5PATH=/sbin:/usr/sbin:/bin:/usr/bin
6
7# ifup-post can't be done for slip :-( Solution: use PPP
8
de1fc6ce
JR
9. /etc/sysconfig/network
10. /etc/rc.d/init.d/functions
baa6b418 11. /etc/sysconfig/network-scripts/functions.network
de1fc6ce 12
7742e157
AF
13# become a daemon in case we have to persist.
14if [ "$1" != daemon ] ; then
74a7f2e4 15 # disconnect stdin, out, err to disassociate from controlling tty
16 # so that no HUPs will get through.
17 $0 daemon $*& </dev/null >/dev/null 2>/dev/null
18 exit 0
7742e157
AF
19fi
20shift
21
12de71be 22CONFIG=$1
7742e157
AF
23source_config
24
dd4a755f 25if [ "foo$2" = "fooboot" ] && is_no ${ONBOOT}; then
74a7f2e4 26 exit
7742e157
AF
27fi
28
de1fc6ce
JR
29# set all major variables
30setup_ip_param
31
7742e157 32if [ -z "$RETRYTIMEOUT" ]; then
74a7f2e4 33 RETRYTIMEOUT=30
7742e157
AF
34fi
35
39465f4f 36# Try to load slip module
de1fc6ce 37if is_module "slip"; then
74a7f2e4 38 /sbin/modprobe -s -k slip
39465f4f
AM
39fi
40
c24e165d 41# we can use dip or direct slip connection via slattach
dd4a755f 42if is_no "$DIRECT_CONNECT"; then
c24e165d 43
74a7f2e4 44 [ -x /usr/sbin/dip ] || {
45 nls "%s does not exist or is not executable" "/usr/sbin/dip"
46 nls "%s for %s exiting" "ifup-sl" "$DEVICE"
47 logger -p daemon.info -t ifup-sl \
48 "$(nls '%s does not exist or is not executable for %s' "/usr/sbin/dip" "$DEVICE")"
49 exit 1
50 }
51
52 DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$DEVNAME
53 [ -f $DIPSCRIPT ] || {
54 DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$PARENTDEVNAME
55 }
56 [ -f $DIPSCRIPT ] || {
57 nls '%s does not exist' "/etc/sysconfig/interfaces/data/dip-$DEVICE"
58 nls 'ifup-sl - %s exiting' "$DEVICE"
59 logger -p daemon.info -t ifup-sl \
60 "$(nls '%s does not exist for %s' "/etc/sysconfig/interfaces/data/dip-$DEVICE" "$DEVICE")"
61 exit 1
62 }
63
64 while : ; do
65 echo > /var/run/sl-$DEVICE.dev
66 (logger -p daemon.info -t ifup-sl \
67 "$(nls 'dip started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)&
68 doexec /usr/sbin/dip dip-$DEVICE $DIPSCRIPT
69 if is_no "$PERSIST" || [ ! -f /var/run/sl-$DEVICE.dev ] ; then
70 exit 0
71 fi
72 rm -f /var/run/sl-$DEVICE.dev
73
74 sleep $RETRYTIMEOUT || {
75 # sleep was killed
76 exit 0
77 }
78 done
7742e157 79
c24e165d 80else
93f97fc9 81
74a7f2e4 82 # direct connection via slattach
83 [ -z "$MTU" ] && MTU=1500
84 [ -z "$PROTOCOL" ] && PROTOCOL=slip
c24e165d 85
74a7f2e4 86 [ -x /sbin/slattach ] || {
de1fc6ce 87 nls "%s is missing. Can't continue." "/sbin/slattach"
58b1ce6c 88 nls "ifup-sl - %s exiting" "$DEVICE"
74a7f2e4 89 logger -p daemon.info -t ifup-sl \
90 "$(nls '%s does not exist or is not executable for %s' "/sbin/slattach" "$DEVICE")"
91 exit 1
92 }
93
94 echo > /var/run/sl-$DEVICE.dev
95 (logger -p daemon.info -t ifup-sl \
96 "$(nls 'slattach started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)&
97
98 slattach -p $PROTOCOL -s $LINESPEED $MODEMPORT &
99 usleep 1500
100
101 if is_yes "$IPV4_NETWORKING"; then
102 if [ -n "$IP4ADDR" -a -n "$REMIP" ]; then
103 # Peer is only for IPv4
104 ip -4 addr add $IP4ADDR peer $REMIP dev $DEVICE
105 fi
106 fi
107
108 if is_yes "$IPV6_NETWORKING"; then
109 if [ -n "$IP6ADDR" ]; then
110 ip -6 addr add $IP6ADDR dev $DEVICE
de1fc6ce 111 fi
74a7f2e4 112 fi
113
114 ip link set $DEVICE mtu $MTU up
de1fc6ce 115
74a7f2e4 116 # IPv4/6 gateways and default routes
117 setup_ip_gw_ro
98626acd 118
74a7f2e4 119 /etc/sysconfig/network-scripts/ifup-post $1
c24e165d
AM
120
121fi
122
de1fc6ce
JR
123
124# This must be last line !
31abb21f 125# vi:syntax=sh:ts=8:sw=4
This page took 0.107828 seconds and 4 git commands to generate.