/[baselayout]/trunk/net.Linux/pppd.sh
Gentoo

Diff of /trunk/net.Linux/pppd.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2625 Revision 2626
14 14
15requote() { 15requote() {
16 printf "'%s' " "$@" 16 printf "'%s' " "$@"
17} 17}
18 18
19pppd_start() { 19pppd_pre_start() {
20 ${IN_BACKGROUND} && return 0 20 ${IN_BACKGROUND} && return 0
21 21
22 # Interface has to be called ppp
22 if [ "${IFACE%%[0-9]*}" != "ppp" ] ; then 23 [ "${IFACE%%[0-9]*}" = "ppp" ] || return 0
23 eerror "PPP can only be invoked from net.ppp[0-9]"
24 return 1
25 fi
26 24
27 local link= i= opts= unit="${IFACE#ppp}" mtu= 25 local link= i= opts= unit="${IFACE#ppp}" mtu=
28 if [ -z "${unit}" ] ; then 26
29 eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
30 return 1
31 fi
32
33 # PPP requires a link to communicate over - normally a serial port 27 # PPP requires a link to communicate over - normally a serial port
34 # PPPoE communicates over Ethernet 28 # PPPoE communicates over Ethernet
35 # PPPoA communicates over ATM 29 # PPPoA communicates over ATM
36 # In all cases, the link needs to be available before we start PPP 30 # In all cases, the link needs to be available before we start PPP
37 eval link=\$link_${IFVAR} 31 eval link=\$link_${IFVAR}
38 if [ -z "${link}" ] ; then 32 [ -n "${link}" ] || return 0
39 eerror "link_${IFVAR} has not been set in /etc/conf.d/net"
40 return 1
41 fi
42 33
43 case "${link}" in 34 case "${link}" in
44 /*) 35 /*)
45 if [ ! -e "${link}" ] ; then 36 if [ ! -e "${link}" ] ; then
46 eerror "${link} does not exist" 37 eerror "${link} does not exist"
47 eerror "Please verify hardware or kernel module (driver)" 38 eerror "Please verify hardware or kernel module (driver)"
48 return 1 39 return 1
49 fi 40 fi
50 ;; 41 ;;
51 esac 42 esac
43
44 if [ -z "${unit}" ] ; then
45 eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
46 return 1
47 fi
52 48
53 eval $(_get_array "pppd_${IFVAR}") 49 eval $(_get_array "pppd_${IFVAR}")
54 opts="$@" 50 opts="$@"
55 51
56 local mtu= hasmtu=false hasmru=false hasmaxfail=false haspersits=false 52 local mtu= hasmtu=false hasmru=false hasmaxfail=false haspersits=false
197 193
198 # pppd will re-call us when we bring the interface up 194 # pppd will re-call us when we bring the interface up
199 exit 0 195 exit 0
200} 196}
201 197
198# Dummy function for users that still have config_ppp0="ppp"
199pppd_start() {
200 return 0
201}
202
202pppd_stop() { 203pppd_stop() {
203 ${IN_BACKGROUND} && return 0 204 ${IN_BACKGROUND} && return 0
204 local pidfile="/var/run/ppp-${IFACE}.pid" 205 local pidfile="/var/run/ppp-${IFACE}.pid"
205 206
206 [ ! -s "${pidfile}" ] && return 0 207 [ ! -s "${pidfile}" ] && return 0

Legend:
Removed from v.2625  
changed lines
  Added in v.2626

  ViewVC Help
Powered by ViewVC 1.1.20