aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2020-01-03 21:30:28 +0100
committerRobin H. Johnson <robbat2@gentoo.org>2020-01-03 23:58:21 -0800
commit9472b0e2fd402819963f492fe9ba37c82c0de277 (patch)
tree209b6e68ae13a78568359106e20c3e12447ed133
parentnet/iw.sh: minor whitespace fix (diff)
downloadnetifrc-9472b0e2fd402819963f492fe9ba37c82c0de277.tar.gz
netifrc-9472b0e2fd402819963f492fe9ba37c82c0de277.tar.bz2
netifrc-9472b0e2fd402819963f492fe9ba37c82c0de277.zip
pppd.sh: ppp-2.4.8 introduced "defaultroute-metric" option
That option name differs from the one we patched into previous pppd releases so check if we are on >=2.4.8 version and use the correct option name accordingly Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> Closes: https://bugs.gentoo.org/704722 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--net/pppd.sh34
1 files changed, 32 insertions, 2 deletions
diff --git a/net/pppd.sh b/net/pppd.sh
index 6ca1396..796722e 100644
--- a/net/pppd.sh
+++ b/net/pppd.sh
@@ -21,6 +21,32 @@ requote()
printf "'%s' " "$@"
}
+pppd_is_ge_248()
+{
+ local ver_str="$(/usr/sbin/pppd --version 2>&1 | grep -o '[[:digit:]\.]\+')"
+ local maj_ver="$(echo ${ver_str} | cut -d . -f 1)"
+ local min_ver="$(echo ${ver_str} | cut -d . -f 2)"
+ local patch_ver="$(echo ${ver_str} | cut -d . -f 3)"
+
+ if [ "${maj_ver}" -gt 2 ] ; then
+ return 0
+ elif [ "${maj_ver}" -eq 2 ] ; then
+ if [ "${min_ver}" -gt 4 ] ; then
+ return 0
+ elif [ "${min_ver}" -eq 4 ] ; then
+ if [ "${patch_ver}" -ge 8 ] ; then
+ return 0
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+}
+
pppd_pre_start()
{
# Interface has to be called ppp
@@ -39,7 +65,10 @@ pppd_pre_start()
return 0
fi
- local link= i= unit="${IFACE#ppp}" opts=
+ local link= i= unit="${IFACE#ppp}" opts= routemetric=defaultmetric
+
+ # https://github.com/paulusmack/ppp/commit/35e5a569c988b1ff865b02a24d9a727a00db4da9
+ pppd_is_ge_248 && routemetric=defaultroute-metric
# PPP requires a link to communicate over - normally a serial port
# PPPoE communicates over Ethernet
@@ -76,6 +105,7 @@ pppd_pre_start()
return 1
;;
defaultmetric) hasdefaultmetric=true;;
+ defaultroute-metric) hasdefaultmetric=true;;
mtu) hasmtu=true;;
mru) hasmru=true;;
maxfail) hasmaxfail=true;;
@@ -98,7 +128,7 @@ pppd_pre_start()
local m=
eval m=\$metric_${IFVAR}
[ -z "${m}" ] && : $(( m = metric + $(_ifindex) ))
- opts="${opts} defaultmetric ${m}"
+ opts="${opts} ${routemetric} ${m}"
fi
if [ -n "${mtu}" ]; then
${hasmtu} || opts="${opts} mtu ${mtu}"