From 7003483a9146353872b0d9a3cea0f8b272bd5b62 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 2 Nov 2007 11:02:07 +0000 Subject: Fix ppp config, #197775. --- ChangeLog | 1 + conf.d.Linux/net.example | 32 ++++++++++++++++---------------- net.Linux/pppd.sh | 21 +++++++++++---------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index af39cbc3..20d9269e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ 02 Nov 2007; Roy Marples : + Fix ppp config, #197775. Fix an ifconfig calculation for shells that don't support the newer POSIX shell math expansion, #197856. diff --git a/conf.d.Linux/net.example b/conf.d.Linux/net.example index c2d4b371..cda4edb6 100644 --- a/conf.d.Linux/net.example +++ b/conf.d.Linux/net.example @@ -701,22 +701,22 @@ # Dial-up PPP users need to specify at least one telephone number #phone_number_ppp0="12345689" # Maximum 2 phone numbers are supported # They will also need a chat script - here's a good one -#chat_ppp0=" \ -# 'ABORT' 'BUSY' \ -# 'ABORT' 'ERROR' \ -# 'ABORT' 'NO ANSWER' \ -# 'ABORT' 'NO CARRIER' \ -# 'ABORT' 'NO DIALTONE' \ -# 'ABORT' 'Invalid Login' \ -# 'ABORT' 'Login incorrect' \ -# 'TIMEOUT' '5' \ -# '' 'ATZ' \ -# 'OK' 'AT' # Put your modem initialization string here \ -# 'OK' 'ATDT\T' \ -# 'TIMEOUT' '60' \ -# 'CONNECT' '' \ -# 'TIMEOUT' '5' \ -# '~--' '' \ +#chat_ppp0=" +#ABORT BUSY +#ABORT ERROR +#ABORT 'NO ANSWER' +#ABORT 'NO CARRIER' +#ABORT 'NO DIALTONE' +#ABORT 'Invalid Login' +#ABORT 'Login incorrect' +#TIMEOUT 5 +#'' ATZ +#OK AT # Put your modem initialization string here +#OK 'ATDT\T' +#TIMEOUT 60 +#CONNECT '' +#TIMEOUT 5 +#~-- '' #" # If the link require extra configuration - for example wireless or diff --git a/net.Linux/pppd.sh b/net.Linux/pppd.sh index 4dbad395..30f2cb67 100644 --- a/net.Linux/pppd.sh +++ b/net.Linux/pppd.sh @@ -33,7 +33,7 @@ pppd_pre_start() { return 0 fi - local link= i= unit="${IFACE#ppp}" opts= + local link= i= unit="${IFACE#ppp}" opts= # PPP requires a link to communicate over - normally a serial port # PPPoE communicates over Ethernet @@ -57,7 +57,9 @@ pppd_pre_start() { return 1 fi - eval opts=\$pppd_${IFVAR} + # We need to flatten the useless array + set -- $(_get_array "pppd_${IFVAR}") + opts="$@" local mtu= hasmtu=false hasmru=false hasmaxfail=false haspersist=false local hasupdetach=false hasdefaultmetric=false @@ -117,16 +119,15 @@ pppd_pre_start() { opts="unit ${unit} ${opts}" # Setup connect script - local chatopts="/usr/sbin/chat -e -E -v" phone= + local chatprog="/usr/sbin/chat -e -E -v" phone= eval phone=\$phone_number_${IFVAR} set -- ${phone} - [ -n "$1" ] && chatopts="${chatopts} -T '$1'" - [ -n "$2" ] && chatopts="${chatopts} -U '$2'" - local chat="$(_get_array "chat_${IFVAR}")" - if [ "${chat}" ] ; then - local IFS="$__IFS" - opts="${opts} connect $(printf "\\'%s\\'" "${chatopts} $(printf "\\'\\\\'\\'%s\\'\\\'' " "$@")")" - unset IFS + [ -n "$1" ] && chatprog="${chatprog} -T '$1'" + [ -n "$2" ] && chatprog="${chatprog} -U '$2'" + # We need to flatten the useless array + set -- $(_get_array "chat_${IFVAR}") + if [ $# != 0 ]; then + opts="${opts} connect '$(echo ${chatprog} $@ | sed -e "s:':'\\\\'':g")'" fi # Add plugins -- cgit v1.2.3