From: Zoran Dzelajlija Date: Mon, 30 Jan 2006 12:14:23 +0000 (+0000) Subject: r91: Pazi na slucaj cudne mrezne konfiguracije -- visestrukih X-Git-Tag: debian/3.0.0~21 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=d77e70e31638a50f6c1dceb4d5b11c6959ab3857;p=carnet-tools-cn.git r91: Pazi na slucaj cudne mrezne konfiguracije -- visestrukih default routa. --- diff --git a/changelog.CARNet b/changelog.CARNet index f45454b..1b83c38 100644 --- a/changelog.CARNet +++ b/changelog.CARNet @@ -1,3 +1,9 @@ +carnet-tools-cn (2.5.1) sarge; urgency=low + + * Ignoriranje visestrukih default route. + + -- Zoran Dzelajlija Sun, 25 Dec 2005 00:32:52 +0100 + carnet-tools-cn (2.5) sarge; urgency=low * Dodane -n, -p i -d opcije za cp_backup_conffile. diff --git a/functions.sh b/functions.sh index 8c2e0e8..a50c280 100644 --- a/functions.sh +++ b/functions.sh @@ -88,8 +88,14 @@ cp_get_ifdefault() { RET="" case $1 in - dev) RET=`route -n | awk '/^0.0.0.0/{print $8}'` ;; - addr) RET=`route -n | awk '/^0.0.0.0/{print $2}'` ;; + 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 ;; esac