From: Zoran Dzelajlija Date: Mon, 30 Jan 2006 13:15:15 +0000 (+0000) Subject: r96: ispravna verzija bugfixa za visestruke default route. X-Git-Tag: debian/3.0.0~20 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=dd60228fb054bcc7ad1f222d1de6c7f351c00069;p=carnet-tools-cn.git r96: ispravna verzija bugfixa za visestruke default route. --- diff --git a/functions.sh b/functions.sh index a50c280..84af780 100644 --- a/functions.sh +++ b/functions.sh @@ -88,15 +88,19 @@ cp_get_ifdefault() { RET="" case $1 in - dev) RET=`route -n | \ - awk 'BEGIN {m = 2^32} - /^0.0.0.0\b/{if ($5 < m) {r = $8; m = $5}} - END {print r}'` - addr) RET=`route -n | \ - awk 'BEGIN {m = 2^32} - /^0.0.0.0\b/{if ($5 < m) {r = $2; m = $5}} - END {print r}'` - *) echo "cp_get_ifdefault: Argument required (dev or addr)" >&2 ;; + dev) + RET=`route -n | awk 'BEGIN {m = 2^32} + /^0\.0\.0\.0[ \t]/ {if ($5 < m) {r = $8; m = $5}} + END {print r}'` + ;; + addr) + RET=`route -n | awk 'BEGIN {m = 2^32} + /^0\.0\.0\.0[ \t]/ {if ($5 < m) {r = $2; m = $5}} + END {print r}'` + ;; + *) + echo "cp_get_ifdefault: Argument required (dev or addr)" >&2 + ;; esac [ -z "$RET" -a "$1" ] && echo "cp_get_ifdefault: No default route" >&2