From 2fdff9d8d6ada5cf75c45d56872c6cbdc0d18e59 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 7 Aug 2007 21:01:16 +0000 Subject: [PATCH] Always give ppp a defaultmetric --- net.Linux/ifconfig.sh | 4 ++++ net.Linux/iproute2.sh | 4 ++++ net.Linux/pppd.sh | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/net.Linux/ifconfig.sh b/net.Linux/ifconfig.sh index 7192ca8a..afa2edea 100644 --- a/net.Linux/ifconfig.sh +++ b/net.Linux/ifconfig.sh @@ -27,6 +27,10 @@ _ifindex() { "${IFACE}:"*) echo "${i}"; return 0;; esac done < /proc/net/dev + + # Return the next available index + i=$((${i} + 1)) + echo "${i}" return 1 } diff --git a/net.Linux/iproute2.sh b/net.Linux/iproute2.sh index fa1171d4..1621c7e1 100644 --- a/net.Linux/iproute2.sh +++ b/net.Linux/iproute2.sh @@ -28,6 +28,10 @@ _ifindex() { "${IFACE}:"*) echo "${i}"; return 0;; esac done < /proc/net/dev + + # Return the next available index + i=$((${i} + 1)) + echo "${i}" return 1 } diff --git a/net.Linux/pppd.sh b/net.Linux/pppd.sh index 311bb8de..d8448f81 100644 --- a/net.Linux/pppd.sh +++ b/net.Linux/pppd.sh @@ -20,6 +20,9 @@ pppd_pre_start() { # Interface has to be called ppp [ "${IFACE%%[0-9]*}" = "ppp" ] || return 0 + # Set our base metric + metric=4000 + if ${IN_BACKGROUND} ; then local config= eval config=\$config_${IFVAR} @@ -87,7 +90,8 @@ pppd_pre_start() { if ! ${hasdefaultmetric} ; then local m=\$metric_${IFVAR} - [ -n "${m}" ] && opts="${opts} defaultmetric ${m}" + [ -z "${m}" ] && m=$((${metric} + _ifindex)) + opts="${opts} defaultmetric ${m}" fi if [ -n "${mtu}" ] ; then ${hasmtu} || opts="${opts} mtu ${mtu}"