commit:     95105e7437c1680d564279f4dd7063d7241370ac
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 24 00:23:06 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 00:23:06 2016 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=95105e74

iproute2/_get_route: do not include metric in test for existing route.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 net/iproute2.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/iproute2.sh b/net/iproute2.sh
index 938a5fb..1dff3fe 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -232,13 +232,13 @@ _add_route()
                set -- "${one}" "${two}" via "$@"
        fi
 
-       local cmd= have_metric=false
+       local cmd= cmd_nometric= have_metric=false
        while [ -n "$1" ]; do
                case "$1" in
-                       metric) cmd="${cmd} metric $2"; shift ; 
have_metric=true;;
-                       netmask) cmd="${cmd}/$(_netmask2cidr "$2")"; shift;;
+                       metric) metric=$2 ; cmd="${cmd} metric $2" ; shift ; 
have_metric=true ;;
+                       netmask) x="/$(_netmask2cidr "$2")" ; cmd="${cmd}${x}" 
; cmd_nometric="${cmd}${x}" ; shift;;
                        -host|-net);;
-                       *) cmd="${cmd} $1";;
+                       *) cmd="${cmd} ${1}" ; cmd_nometric="${cmd_nometric} 
${1}" ;;
                esac
                shift
        done
@@ -252,7 +252,7 @@ _add_route()
        fi
 
        # Check for route already existing:
-       ip ${family} route show ${cmd} dev "${IFACE}" 2>/dev/null | \
+       ip ${family} route show ${cmd_nometric} dev "${IFACE}" 2>/dev/null | \
                fgrep -sq "${cmd%% *}"
        route_already_exists=$?
 

Reply via email to