|
Lines 3-8
Link Here
|
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
# Author: Martin Schlemmer <azarah@gentoo.org> |
4 |
# Author: Martin Schlemmer <azarah@gentoo.org> |
| 5 |
# Credits: To all those I got ideas from :) |
5 |
# Credits: To all those I got ideas from :) |
|
|
6 |
# Modified by HS - (ver. 4) |
| 6 |
# |
7 |
# |
| 7 |
# $Header: /home/cvsroot/gentoo-x86/net-dialup/ppp/files/net.ppp0,v 1.3 2003/09/06 11:11:27 seemant Exp $ |
8 |
# $Header: /home/cvsroot/gentoo-x86/net-dialup/ppp/files/net.ppp0,v 1.3 2003/09/06 11:11:27 seemant Exp $ |
| 8 |
|
9 |
|
|
Lines 25-31
Link Here
|
| 25 |
if [ -e "/var/run/ppp-${IFACE}.pid" -o -e "/var/run/${IFACE}.pid" ] && \ |
26 |
if [ -e "/var/run/ppp-${IFACE}.pid" -o -e "/var/run/${IFACE}.pid" ] && \ |
| 26 |
[ "${FUNCT}" = "start" ] |
27 |
[ "${FUNCT}" = "start" ] |
| 27 |
then |
28 |
then |
| 28 |
eerror "ppp0 is already up" |
29 |
eerror "${IFACE} is already up" |
| 29 |
return 1 |
30 |
return 1 |
| 30 |
fi |
31 |
fi |
| 31 |
} |
32 |
} |
|
Lines 61-83
Link Here
|
| 61 |
if [ -x "$(which ifconfig)" ] |
62 |
if [ -x "$(which ifconfig)" ] |
| 62 |
then |
63 |
then |
| 63 |
|
64 |
|
| 64 |
if [ -z "$(/sbin/ifconfig | egrep "${IFACE}")" ] |
65 |
# Obtain interface name from pid file (IFACE is actually linkname) |
|
|
66 |
if [ -e /var/run/ppp-${IFACE}.pid ] |
| 67 |
then |
| 68 |
IFNAME=$(egrep "ppp" /var/run/ppp-${IFACE}.pid) |
| 69 |
fi |
| 70 |
if [ -z "${IFNAME}" ] |
| 71 |
then |
| 72 |
IFNAME=${IFACE} |
| 73 |
fi |
| 74 |
|
| 75 |
if [ -z "$(/sbin/ifconfig | egrep "${IFNAME}")" ] |
| 65 |
then |
76 |
then |
|
|
77 |
|
| 78 |
# Link is not up but pppd may be running |
| 66 |
ewarn "Interface seems to be down already" |
79 |
ewarn "Interface seems to be down already" |
| 67 |
# We should return 0 here, else svc_stop() will not remove |
|
|
| 68 |
# the 'started' symlink ... |
| 69 |
return 0 |
| 70 |
fi |
80 |
fi |
| 71 |
|
81 |
|
| 72 |
# /sbin/ifconfig ${IFACE} down |
82 |
# /sbin/ifconfig ${IFACE} down |
| 73 |
if [ -e /var/run/ppp-${IFACE}.pid ] |
83 |
if [ -e /var/run/ppp-${IFACE}.pid ] |
| 74 |
then |
84 |
then |
| 75 |
kill $(egrep -v "${IFACE}" /var/run/ppp-${IFACE}.pid) |
85 |
PID=$(egrep -v "${IFNAME}" /var/run/ppp-${IFACE}.pid) |
| 76 |
|
|
|
| 77 |
elif [ -e /var/run/${IFACE}.pid ] |
86 |
elif [ -e /var/run/${IFACE}.pid ] |
| 78 |
then |
87 |
then |
| 79 |
kill $(egrep -v "${IFACE}" /var/run/${IFACE}.pid) |
88 |
PID=$(egrep -v "${IFNAME}" /var/run/${IFACE}.pid) |
| 80 |
fi |
89 |
fi |
|
|
90 |
|
| 91 |
if [ -n "${PID}" ] |
| 92 |
then |
| 93 |
kill ${PID} |
| 94 |
sleep 0.5 |
| 95 |
|
| 96 |
# Try to kill pppd repeatedly (sometimes, (e.g. if connection |
| 97 |
# is not established) pppd ignores SIGTERM for a while) |
| 98 |
PID_TMP=`pstree -p ${PID}` |
| 99 |
PID_TMP=`echo ${PID_TMP} | sed -e 's:^.*pppd(\|).*::g'` |
| 100 |
COUNT=0 |
| 101 |
while [ -n "${PID_TMP}" ] && [ ${COUNT} -lt 10 ] |
| 102 |
do |
| 103 |
kill ${PID} |
| 104 |
sleep 0.5 |
| 105 |
PID_TMP=`pstree -p ${PID}` |
| 106 |
PID_TMP=`echo ${PID_TMP} | sed -e 's:^.*pppd(\|).*::g'` |
| 107 |
let COUNT++ |
| 108 |
done |
| 109 |
fi |
| 110 |
|
| 111 |
if [ -n "${PID_TMP}" ] |
| 112 |
then |
| 113 |
eend 1 "Error stopping pppd" |
| 114 |
fi |
| 115 |
|
| 81 |
fi |
116 |
fi |
| 82 |
eend |
117 |
eend |
| 83 |
} |
118 |
} |
|
Lines 166-181
Link Here
|
| 166 |
chmod 600 /etc/ppp/pap-secrets |
201 |
chmod 600 /etc/ppp/pap-secrets |
| 167 |
|
202 |
|
| 168 |
# Setup the chat file |
203 |
# Setup the chat file |
| 169 |
if [ -n "${INITSTRING}" ] |
204 |
if [ "${AUTOCHATSCRIPT}" = "yes" ] |
| 170 |
then |
205 |
then |
| 171 |
sed -e "9i\\'OK\' \'${INITSTRING}\'" \ |
206 |
if [ -n "${INITSTRING}" ] |
| 172 |
-e "s:\$NUMBER:${NUMBER}:" \ |
207 |
then |
| 173 |
${TEMPLATEDIR}/chat-default \ |
208 |
sed -e "9i\\'OK\' \'${INITSTRING}\'" \ |
| 174 |
>/etc/ppp/chat-${PEER} |
209 |
-e "s:\$NUMBER:${NUMBER}:" \ |
| 175 |
else |
210 |
${TEMPLATEDIR}/chat-default \ |
| 176 |
sed -e "s:\$NUMBER:${NUMBER}:" \ |
211 |
>/etc/ppp/chat-${PEER} |
| 177 |
${TEMPLATEDIR}/chat-default \ |
212 |
else |
| 178 |
>/etc/ppp/chat-${PEER} |
213 |
sed -e "s:\$NUMBER:${NUMBER}:" \ |
|
|
214 |
${TEMPLATEDIR}/chat-default \ |
| 215 |
>/etc/ppp/chat-${PEER} |
| 216 |
fi |
| 179 |
fi |
217 |
fi |
| 180 |
|
218 |
|
| 181 |
# Setup the ip-scripts so long |
219 |
# Setup the ip-scripts so long |