]>
Commit | Line | Data |
---|---|---|
744eae05 AM |
1 | #!/bin/sh |
2 | # | |
3 | # pppoe-relay PPP over Ethernet Relay Server | |
4 | # | |
5 | # chkconfig: 345 47 53 | |
6 | # | |
7 | # description: PPP over Ethernet Relay Server | |
8 | # | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Get network config | |
14 | . /etc/sysconfig/network | |
15 | ||
16 | # Get service config | |
17 | [ -f /etc/sysconfig/pppoe-relay ] && . /etc/sysconfig/pppoe-relay | |
18 | ||
19 | # Check that networking is up. | |
c809026e | 20 | if is_yes "${NETWORKING}"; then |
c7d630b3 | 21 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
c809026e | 22 | msg_network_down "PPPoE Relay Server" |
23 | exit 1 | |
24 | fi | |
25 | else | |
26 | exit 0 | |
27 | fi | |
744eae05 AM |
28 | |
29 | PPPOE_RELAY_IFACES_SERVERS_OPT= | |
30 | for iface in $PPPOE_RELAY_IFACES_SERVERS; do | |
c809026e | 31 | PPPOE_RELAY_IFACES_SERVERS_OPT="-S $iface $$PPPOE_RELAY_IFACES_SERVERS" |
744eae05 | 32 | done |
c809026e | 33 | |
744eae05 AM |
34 | PPPOE_RELAY_IFACES_CLIENTS= |
35 | for iface in $PPPOE_RELAY_IFACES_CLIENTS; do | |
c809026e | 36 | PPPOE_RELAY_IFACES_CLIENTS_OPT="-C $iface $PPPOE_RELAY_IFACES_CLIENTS" |
744eae05 AM |
37 | done |
38 | PPPOE_RELAY_IFACES_BOTH= | |
39 | for iface in $PPPOE_RELAY_IFACES_BOTH; do | |
c809026e | 40 | PPPOE_RELAY_IFACES_BOTH_OPT="-B $iface $PPPOE_RELAY_IFACES_BOTH" |
744eae05 AM |
41 | done |
42 | ||
43 | [ -z "$PPPOE_RELAY_MAX_SESSIONS" ] && PPPOE_RELAY_MAX_SESSIONS=500 | |
44 | [ -z "$PPPOE_RELAY_TIMEOUT" ] && PPPOE_RELAY_TIMEOUT=600 | |
45 | ||
53632159 | 46 | RETVAL=0 |
744eae05 AM |
47 | # See how we were called. |
48 | case "$1" in | |
49 | start) | |
50 | # Check if the service is already running? | |
51 | if [ ! -f /var/lock/subsys/pppoe-relay ]; then | |
52 | msg_starting "PPPoE Relay Server" | |
53 | for iface in $PPPOE_RELAY_IFACES_SERVERS $PPPOE_RELAY_IFACES_CLIENTS $PPPOE_RELAY_IFACES_BOTH; do | |
c809026e | 54 | ip link set $iface up 2> /dev/null |
744eae05 AM |
55 | done |
56 | daemon /usr/sbin/pppoe-relay \ | |
57 | $PPPOE_RELAY_IFACES_SERVERS_OPT \ | |
58 | $PPPOE_RELAY_IFACES_CLIENTS_OPT \ | |
59 | $PPPOE_RELAY_IFACES_BOTH_OPT \ | |
60 | -n $PPPOE_RELAY_MAX_SESSIONS -i $PPPOE_RELAY_TIMEOUT | |
61 | RETVAL=$? | |
62 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pppoe-relay | |
63 | else | |
64 | msg_already_running "PPPoE Relay Server" | |
65 | fi | |
66 | ;; | |
67 | stop) | |
c809026e | 68 | if [ -f /var/lock/subsys/pppoe-relay ]; then |
744eae05 AM |
69 | msg_stopping "PPPoE Relay Server" |
70 | killproc pppoe-relay | |
71 | rm -f /var/lock/subsys/pppoe-relay >/dev/null 2>&1 | |
72 | else | |
73 | msg_not_running "PPPoE Relay Server" | |
744eae05 AM |
74 | fi |
75 | ;; | |
53632159 | 76 | restart|force-reload) |
744eae05 AM |
77 | $0 stop |
78 | $0 start | |
53632159 | 79 | exit $? |
744eae05 AM |
80 | ;; |
81 | status) | |
82 | status pppoe-relay | |
53632159 | 83 | exit $? |
744eae05 AM |
84 | ;; |
85 | *) | |
53632159 | 86 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
87 | exit 3 | |
744eae05 AM |
88 | esac |
89 | ||
90 | exit $RETVAL |