3 # $Id: ifup-ppp,v 1.14 2001/03/22 21:50:36 qboosh 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
23 . /etc/sysconfig/network
24 . /etc/rc.d/init.d/functions
25 . /etc/sysconfig/network-scripts/.functions
28 [ -z "$HOLDOFF" ] && HOLDOFF=30
30 if [ "$2" = "boot" ] && is_no "${ONBOOT}"; then
33 [ -x /usr/sbin/pppd ] || {
34 echo "/usr/sbin/pppd does not exist or is not executable"
35 echo "ifup-ppp for $DEVICE exiting"
36 logger -p daemon.info -t ifup-ppp \
37 "/usr/sbin/pppd does not exist or is not executable for $DEVICE"
42 if is_yes "${PERSIST}"; then
43 if [ -z "${MAXFAIL}" ]; then
46 opts="$opts persist holdoff $HOLDOFF maxfail $MAXFAIL"
48 if is_yes "${DEMAND}"; then
49 if [ -z "${IDLE}" ]; then
52 opts="$opts demand idle ${IDLE}"
54 if is_yes "${HARDFLOWCTL}"; then
55 opts="$opts modem crtscts"
57 if is_yes "${ESCAPECHARS}"; then
58 opts="$opts asyncmap FFFFFFFF"
59 elif [ "${ESCAPECHARS}" = no ] ; then
60 opts="$opts asyncmap 00000000"
62 if is_yes "${DEFROUTE}" = yes; then
63 opts="$opts defaultroute"
65 if [ -n "${MRU}" ] ; then
66 opts="$opts mru ${MRU}"
68 if [ -n "${MTU}" ] ; then
69 opts="$opts mtu ${MTU}"
71 if [ -n "${IPADDR}${REMIP}" ] ; then
72 # if either IP address is set, the following will work.
73 opts="$opts ${IPADDR}:${REMIP}"
75 if [ -n "${PAPNAME}" ] ; then
76 opts="$opts name ${PAPNAME}"
78 if [ -n "${REMOTENAME}" ] ; then
79 opts="$opts remotename ${REMOTENAME}"
81 if is_yes "${DEBUG}"; then
86 yes) opts="$opts auth"
88 no) opts="$opts noauth"
93 if [ -n "${REPORTFILE}" ] ; then
94 chatrpt="-r ${REPORTFILE}"
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
101 if [ -n "${DATAFORCHAT}" ] ; then
104 /usr/sbin/pppd $opts $MODEMPORT $LINESPEED \
105 connect 'eval /usr/sbin/chat $chatdbg $chatrpt \
106 `grep -v ^# ${CHATSCRIPT}`' \
107 linkname "${DEVICE}" ipparam "${CONFIG}" \
110 /usr/sbin/pppd $opts $MODEMPORT $LINESPEED \
111 linkname "${DEVICE}" ipparam "${CONFIG}" \