Always give ppp a defaultmetric

This commit is contained in:
Roy Marples 2007-08-07 21:01:16 +00:00
parent 3295a9c0e0
commit 2fdff9d8d6
3 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,10 @@ _ifindex() {
"${IFACE}:"*) echo "${i}"; return 0;; "${IFACE}:"*) echo "${i}"; return 0;;
esac esac
done < /proc/net/dev done < /proc/net/dev
# Return the next available index
i=$((${i} + 1))
echo "${i}"
return 1 return 1
} }

View File

@ -28,6 +28,10 @@ _ifindex() {
"${IFACE}:"*) echo "${i}"; return 0;; "${IFACE}:"*) echo "${i}"; return 0;;
esac esac
done < /proc/net/dev done < /proc/net/dev
# Return the next available index
i=$((${i} + 1))
echo "${i}"
return 1 return 1
} }

View File

@ -20,6 +20,9 @@ pppd_pre_start() {
# Interface has to be called ppp # Interface has to be called ppp
[ "${IFACE%%[0-9]*}" = "ppp" ] || return 0 [ "${IFACE%%[0-9]*}" = "ppp" ] || return 0
# Set our base metric
metric=4000
if ${IN_BACKGROUND} ; then if ${IN_BACKGROUND} ; then
local config= local config=
eval config=\$config_${IFVAR} eval config=\$config_${IFVAR}
@ -87,7 +90,8 @@ pppd_pre_start() {
if ! ${hasdefaultmetric} ; then if ! ${hasdefaultmetric} ; then
local m=\$metric_${IFVAR} local m=\$metric_${IFVAR}
[ -n "${m}" ] && opts="${opts} defaultmetric ${m}" [ -z "${m}" ] && m=$((${metric} + _ifindex))
opts="${opts} defaultmetric ${m}"
fi fi
if [ -n "${mtu}" ] ; then if [ -n "${mtu}" ] ; then
${hasmtu} || opts="${opts} mtu ${mtu}" ${hasmtu} || opts="${opts} mtu ${mtu}"