3 # $Id: ifup-ppp,v 1.6 1999/07/13 12:49:37 misiek Exp $
5 # ifup-ppp script for pppd-2.3.5 (with persist & demand options) ver 0.2
6 # Grzegorz Stanislawski <stangrze@open.net.pl>
8 # - since persist option is included to pppd it''s no need to do werid loops
9 # ifup-ppp script. This also makes your logfile grow slower when Your link
11 # - chat-ppp? file with script for chat is now parsed by shell, so You can
12 # include in it shell variables (for example $PHONE, $USERNAME)
13 # You can define any variable in ifcfg-ppp? file and use it in chat-ppp?
14 # You only have to add it's name into DATAFORCHAT variable
15 # Note, that chat-ppp file is now parsed by shell, so you have to escape
16 # with "\" all shell special characters like \$;:)(& etc.
18 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 # ifup-post for PPP is handled through /etc/ppp/ip-up
21 if [ "$1" != daemon ] ; then
22 # disconnect stdin, out, err to disassociate from controlling tty
23 # so that no HUPs will get through.
24 $0 daemon $* </dev/null >/dev/null 2>/dev/null &
30 cd /etc/sysconfig/network-scripts
31 . /etc/rc.d/init.d/functions.network
33 if [ -z "$HOLDOFF" ]; then
36 if [ "$2" = "boot" -a "${ONBOOT}" = "no" ]; then
39 [ -x /usr/sbin/pppd ] || {
40 echo "/usr/sbin/pppd does not exist or is not executable"
41 echo "ifup-ppp for $DEVICE exiting"
42 logger -p daemon.info -t ifup-ppp \
43 "/usr/sbin/pppd does not exist or is not executable for $DEVICE"
46 #[ -f /etc/sysconfig/network-scripts/chat-$DEVICE ] || {
47 # echo "/etc/sysconfig/network-scripts/chat-$DEVICE does not exist"
48 # echo "ifup-ppp for $DEVICE exiting"
49 # logger -p daemon.info -t ifup-ppp \
50 # "/etc/sysconfig/network-scripts/chat-$DEVICE does not exist for $DEVICE"
54 if [ "${PERSIST}" = "yes" ]; then
55 opts="$opts persist holdoff $HOLDOFF"
57 if [ "${DEMAND}" = "yes" ]; then
58 #opts="$opts demand active-filter $ACTIVEFILTER idle $IDLE"
61 if [ "${HARDFLOWCTL}" = yes ] ; then
62 opts="$opts modem crtscts"
64 if [ "${ESCAPECHARS}" = yes ] ; then
65 opts="$opts asyncmap FFFFFFFF"
66 elif [ "${ESCAPECHARS}" = no ] ; then
67 opts="$opts asyncmap 00000000"
69 if [ "${DEFROUTE}" = yes ] ; then
70 opts="$opts defaultroute"
72 if [ -n "${MRU}" ] ; then
73 opts="$opts mru ${MRU}"
75 if [ -n "${MTU}" ] ; then
76 opts="$opts mtu ${MTU}"
78 if [ -n "${IPADDR}${REMIP}" ] ; then
79 # if either IP address is set, the following will work.
80 opts="$opts ${IPADDR}:${REMIP}"
82 if [ -n "${PAPNAME}" ] ; then
83 opts="$opts name ${PAPNAME}"
85 if [ "${DEBUG}" = yes ] ; then
89 if [ -n "${REPORTFILE}" ] ; then
90 chatrpt="-r ${REPORTFILE}"
92 #CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$DEVNAMR
93 #[ -f $CHATSCRIPT ] || {
94 # CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$PARENTDEVNAME
96 > /var/run/ppp-$DEVICE.dev
97 (logger -p daemon.info -t ifup-ppp \
98 "pppd started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
99 if [ -n "${CHATSCRIPT}" ] ; then
100 export chatdbg chatrpt CHATSCRIPT
102 /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
103 connect 'eval /usr/sbin/chat $chatdbg $chatrpt \
104 `grep -v ^# ${CHATSCRIPT}`' \
105 remotename $DEVICE ipparam $DEVICE \
108 /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
109 remotename $DEVICE ipparam $DEVICE \
112 echo "$!" > /var/run/ppp-$DEVICE.pid