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