/[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 2547 Revision 2621
17} 17}
18 18
19pppd_start() { 19pppd_start() {
20 ${IN_BACKGROUND} && return 0 20 ${IN_BACKGROUND} && return 0
21 21
22 if [ "${iface%%[0-9]*}" != "ppp" ] ; then 22 if [ "${IFACE%%[0-9]*}" != "ppp" ] ; then
23 eerror "PPP can only be invoked from net.ppp[0-9]" 23 eerror "PPP can only be invoked from net.ppp[0-9]"
24 return 1 24 return 1
25 fi 25 fi
26 26
27 local link= i= opts= unit="${IFACE#ppp}" mtu= 27 local link= i= opts= unit="${IFACE#ppp}" mtu=
28 if [ -z "${unit}" ] ; then 28 if [ -z "${unit}" ] ; then
29 eerror $"PPP requires a unit - use net.ppp[0-9] instead of net.ppp" 29 eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
30 return 1 30 return 1
31 fi 31 fi
32 32
33 # PPP requires a link to communicate over - normally a serial port 33 # PPP requires a link to communicate over - normally a serial port
34 # PPPoE communicates over Ethernet 34 # PPPoE communicates over Ethernet
49 fi 49 fi
50 ;; 50 ;;
51 esac 51 esac
52 52
53 eval $(_get_array "pppd_${IFVAR}") 53 eval $(_get_array "pppd_${IFVAR}")
54 opts="$@" 54 opts=$(requote "$@")
55 55
56 # We don't work with these options set by the user 56 # We don't work with these options set by the user
57 for i in "$@" ; do 57 for i in "$@" ; do
58 set -- ${i} 58 set -- ${i}
59 case "$1" in 59 case "$1" in
74 opts="${opts} plugin passwordfd.so passwordfd 0" 74 opts="${opts} plugin passwordfd.so passwordfd 0"
75 fi 75 fi
76 76
77 # Check for mtu/mru 77 # Check for mtu/mru
78 local mtu= hasmtu=false hasmru=false hasmaxfail=false haspersits=false 78 local mtu= hasmtu=false hasmru=false hasmaxfail=false haspersits=false
79 loal hasupdetach=false 79 local hasupdetach=false
80 eval mtu=\$mtu_${IFVAR} 80 eval mtu=\$mtu_${IFVAR}
81 eval set -- "${opts}"
81 for i in ${opts} ; do 82 for i in "$@" ; do
82 case "${i}" in 83 case "${i}" in
83 mtu" "*) hasmtu=true ;; 84 mtu" "*) hasmtu=true ;;
84 mru" "*) hasmru=true ;; 85 mru" "*) hasmru=true ;;
85 maxfail" "*) hasmaxfail=true ;; 86 maxfail" "*) hasmaxfail=true ;;
86 persist) haspersist=true ;; 87 persist) haspersist=true ;;
87 updetach) hasupdetach=true; 88 updetach) hasupdetach=true;
88 esac 89 esac
89 done 90 done
91 if [ -n "${mtu}" ] ; then
90 ! ${hasmtu} && opts="${opts} mtu ${mtu}" 92 ! ${hasmtu} && opts="${opts} mtu ${mtu}"
91 ! ${hasmru} && opts="${opts} mru ${mtu}" 93 ! ${hasmru} && opts="${opts} mru ${mtu}"
94 fi
92 ! ${hasmailfail} && opts="${opts} maxfail 0" 95 ! ${hasmailfail} && opts="${opts} maxfail 0"
93 ! ${haspersist} && opts="${opts} persist" 96 ! ${haspersist} && opts="${opts} persist"
94 97
95 # Set linkname because we need /var/run/ppp-${linkname}.pid 98 # Set linkname because we need /var/run/ppp-${linkname}.pid
96 # This pidfile has the advantage of being there, even if ${iface} interface was never started 99 # This pidfile has the advantage of being there,
100 # even if ${IFACE} interface was never started
97 opts="linkname ${IFACE} ${opts}" 101 opts="linkname ${IFACE} ${opts}"
98 102
99 # Setup auth info 103 # Setup auth info
100 if [ -n "${username}" ] ; then 104 if [ -n "${username}" ] ; then
101 opts="user '"${username}"' remotename ${IFACE} ${opts}" 105 opts="user '"${username}"' remotename ${IFACE} ${opts}"
121 # Add plugins 125 # Add plugins
122 local haspppoa=false haspppoe=false 126 local haspppoa=false haspppoe=false
123 eval $(_get_array "plugins_${IFVAR}") 127 eval $(_get_array "plugins_${IFVAR}")
124 for i in "$@" ; do 128 for i in "$@" ; do
125 set -- ${i} 129 set -- ${i}
126 case "${i}" in 130 case "$1" in
127 passwordfd) continue;; 131 passwordfd) continue;;
128 pppoa) shift; set -- "rp-pppoe" "$@" ;; 132 pppoa) shift; set -- "rp-pppoe" "$@" ;;
129 pppoe) shift; set -- "pppoatm" "$@" ;; 133 pppoe) shift; set -- "pppoatm" "$@" ;;
130 capi) shift; set -- "capiplugin" "$@" ;; 134 capi) shift; set -- "capiplugin" "$@" ;;
131 esac 135 esac
132 case "${i}" in 136 case "$1" in
133 rp-pppoe) haspppoe=true ;; 137 rp-pppoe) haspppoe=true ;;
134 pppoatm) haspppoa=true ;; 138 pppoatm) haspppoa=true ;;
135 esac 139 esac
136 if [ "$1" = "rp-pppoe" ] || [ "$1" = "pppoatm" -a "${link}" != "/dev/null" ] ; then 140 if [ "$1" = "rp-pppoe" ] || [ "$1" = "pppoatm" -a "${link}" != "/dev/null" ] ; then
137 opts="${opts} connect true" 141 opts="${opts} connect true"
172 else 176 else
173 ewarn "WARNING: An [itf.]vpi.vci ATM address was expected in link_${IFVAR}" 177 ewarn "WARNING: An [itf.]vpi.vci ATM address was expected in link_${IFVAR}"
174 fi 178 fi
175 179
176 fi 180 fi
177 [ "${insert_link_in_opts}" == "0" ] || opts="${link} ${opts}" 181 [ "${insert_link_in_opts}" = "0" ] || opts="${link} ${opts}"
178 182
179 ebegin "Starting pppd in ${IFACE}" 183 ebegin "Starting pppd in ${IFACE}"
180 mark_service_inactive "${SVCNAME}" 184 mark_service_inactive "${SVCNAME}"
181 if [ -n "${username}" ] \ 185 if [ -n "${username}" ] \
182 && [ -n "${password}" -o -z "${passwordset}" ] ; then 186 && [ -n "${password}" -o -z "${passwordset}" ] ; then
186 else 190 else
187 eval start-stop-daemon --start --exec /usr/sbin/pppd \ 191 eval start-stop-daemon --start --exec /usr/sbin/pppd \
188 --pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null 192 --pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null
189 fi 193 fi
190 194
191 if ! eend $? $"Failed to start PPP" ; then 195 if ! eend $? "Failed to start PPP" ; then
192 mark_service_starting "net.${iface}" 196 mark_service_starting "net.${IFACE}"
193 return 1 197 return 1
194 fi 198 fi
195 199
196 if ${hasupdetach} ; then 200 if ${hasupdetach} ; then
197 _show_address 201 _show_address

Legend:
Removed from v.2547  
changed lines
  Added in v.2621

  ViewVC Help
Powered by ViewVC 1.1.20