From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1A627138239 for ; Sat, 4 Jan 2020 07:59:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 19A18E08BE; Sat, 4 Jan 2020 07:59:30 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DC92CE08BE for ; Sat, 4 Jan 2020 07:59:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 033EF34DDDD for ; Sat, 4 Jan 2020 07:59:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9156B17 for ; Sat, 4 Jan 2020 07:59:25 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1578124701.9472b0e2fd402819963f492fe9ba37c82c0de277.robbat2@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: net/ X-VCS-Repository: proj/netifrc X-VCS-Files: net/pppd.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 9472b0e2fd402819963f492fe9ba37c82c0de277 X-VCS-Branch: master Date: Sat, 4 Jan 2020 07:59:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 4f352ee2-1dfb-4bb8-8527-0c1c2ab46b4e X-Archives-Hash: 049d7aab1ea3b6317a8d0323fa8fa59b commit: 9472b0e2fd402819963f492fe9ba37c82c0de277 Author: Lars Wendler gentoo org> AuthorDate: Fri Jan 3 20:30:28 2020 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sat Jan 4 07:58:21 2020 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=9472b0e2 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 gentoo.org> Closes: https://bugs.gentoo.org/704722 Signed-off-by: Robin H. Johnson gentoo.org> net/pppd.sh | 34 ++++++++++++++++++++++++++++++++-- 1 file 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}"