Blame | Last modification | View Log | RSS feed
#! /bin/bash. /etc/init.d/functionscd /etc/sysconfig/network-scripts. ./network-functions# ifup-post for PPP is handled through /etc/ppp/ip-upif [ "${1}" = daemon ] ; then# we've been called from ppp-watch, so don't invoke it for persistenceshiftelse# just in case a full path to the configuration file is passed inCONFIG=${1##*/} # CONFIG=$(basename $1)[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}source_config# don't start ppp-watch by xDSLif [ "${DEMAND}" != yes -a "$TYPE" != "xDSL" ] ; then# let ppp-watch do the right thingexec /sbin/ppp-watch "${CONFIG##ifcfg-}" "$2"fifiCONFIG=$1[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}source_configif [ -z "${DISCONNECTTIMEOUT}" ]; thenDISCONNECTTIMEOUT=2fiif [ -z "${RETRYTIMEOUT}" ]; thenRETRYTIMEOUT=30fiif [ -z "${IDLETIMEOUT}" ]; thenIDLETIMEOUT=600fiif [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; thenexitfi[ -x /usr/sbin/pppd ] || {echo $"pppd does not exist or is not executable"echo $"ifup-ppp for ${DEVICE} exiting"/usr/bin/logger -p daemon.info -t ifup-ppp \$"pppd does not exist or is not executable for ${DEVICE}"exit 1}# check that xDSL connectionif [ "$TYPE" = "xDSL" ] ; thenif [ -x /usr/sbin/adsl-start ] ; thenadsl-start /etc/sysconfig/network-scripts/$CONFIGexit $?else/usr/bin/logger -p daemon.info -t ifup-ppp \$"adsl-start does not exist or is not executable for ${DEVICE}"exit 1fifiPEERCONF=/etc/ppp/peers/${DEVNAME}if [ "${DEBUG}" = "yes" ]; thenCHATDBG="-v"fiif [ ! -f ${PEERCONF} ]; thenif [ -z "${WVDIALSECT}" ] ; thenCHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME}[ -f ${CHATSCRIPT} ] || {echo $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist"echo $"ifup-ppp for ${DEVNAME} exiting"/usr/bin/logger -p daemon.info -t ifup-ppp \$"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}"exit 1}fi/usr/bin/logger -s -p daemon.notice -t ifup-ppp \$"Setting up a new ${PEERCONF} config file"if [ -f /etc/ppp/peers/${DEVICE} ]; thencp -f /etc/ppp/peers/${DEVICE} ${PEERCONF}elsetouch ${PEERCONF}fiif [ "${WVDIALSECT}" ]; thenecho "connect \"/usr/bin/wvdial --remotename ${DEVNAME} --chat '${WVDIALSECT}'\"" >> ${PEERCONF}elseecho "connect \"/usr/sbin/chat ${CHATDBG} -f ${CHATSCRIPT}\"" >> ${PEERCONF}fifiopts="lock"if [ "${HARDFLOWCTL}" != no ] ; thenopts="$opts modem crtscts"fiif [ "${ESCAPECHARS}" != yes ] ; thenopts="$opts asyncmap 00000000"fiif [ "${DEFROUTE}" != no ] ; then# pppd will no longer delete an existing default route# so we have to help it out a little here.DEFRT=$(ip route list match 0.0.0.0/0)[ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routesecho "$DEFRT" | while read spec; doip route del $spec;doneopts="$opts defaultroute"fiif [ "${PEERDNS}" != no ] ; thencp -f /etc/resolv.conf /etc/resolv.conf.saveopts="$opts usepeerdns"fiif [ -n "${MRU}" ] ; thenopts="$opts mru ${MRU}"fiif [ -n "${MTU}" ] ; thenopts="$opts mtu ${MTU}"fiif [ -n "${IPADDR}${REMIP}" ] ; then# if either IP address is set, the following will work.opts="$opts ${IPADDR}:${REMIP}"fiif [ -n "${PAPNAME}" ] ; thenopts="$opts user ${PAPNAME} remotename ${DEVNAME}"fiif [ "${DEBUG}" = yes ] ; thenopts="$opts debug"fiif [ ${DEMAND} = yes ] ; thenopts="$opts demand ktune idle ${IDLETIMEOUT} holdoff ${RETRYTIMEOUT}"exec=elseopts="$opts nodetach"exec=execfi/usr/bin/logger -p daemon.info -t ifup-ppp \$"pppd started for ${DEVNAME} on ${MODEMPORT} at ${LINESPEED}"$exec pppd $opts ${MODEMPORT} ${LINESPEED} \ipparam ${DEVNAME} linkname ${DEVNAME} call ${DEVNAME}\noauth \${PPPOPTIONS} || exitif [ "${DEMAND}" = "yes" ] ; then# pppd is a tad slow to write the pid-file.sleep 2if [ -f /var/run/ppp-${DEVNAME}.pid ] ; thenREALDEVICE=$(tail -1 /var/run/ppp-${DEVNAME}.pid)/etc/sysconfig/network-scripts/ifup-routes ${REALDEVICE} ${DEVNAME}fifi