From: Ivan Rako Date: Mon, 21 Mar 2005 09:10:35 +0000 (+0000) Subject: r12: X-Git-Tag: debian/3.0.0~93 X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=commitdiff_plain;h=d79bdabfd15b6324adc9549290b89178bed98908;p=carnet-tools-cn.git r12: --- diff --git a/README.CARNet b/README.CARNet index 21b9dbc..3ce87ea 100644 --- a/README.CARNet +++ b/README.CARNet @@ -22,6 +22,11 @@ cp_get_ifmask Funkcija vraca IP netmask mreznog sucelja. U slucaju da nije naveden kao argument, vraca IP netmask od loopback sucelja (lo). +cp_get_ifdefault [dev|addr] + + Funkcija vraca naziv uredjaj ili adresu podrazumne rute (default + route). + cp_get_netaddr Funkcija vraca podmrezu mreznog sucelja u CIDR obliku. U slucaju diff --git a/functions.sh b/functions.sh index b4218d1..13429de 100644 --- a/functions.sh +++ b/functions.sh @@ -4,7 +4,11 @@ cp_get_ifaddr() { local ifaddr interface interface="$1" - [ -z "$interface" ] && interface=lo + if [ -z "$interface" ]; then + cp_get_ifdefault dev + interface="$RET" + [ -z "$interface" ] && interface=lo + fi if ! ifconfig $interface 2> /dev/null >> /dev/null; then echo "cp_get_ifaddr: $interface: No such interface" 1>&2 @@ -28,7 +32,11 @@ cp_get_ifmask() { local ifmask interface interface="$1" - [ -z "$interface" ] && interface=lo + if [ -z "$interface" ]; then + cp_get_ifdefault dev + interface="$RET" + [ -z "$interface" ] && interface=lo + fi if ! ifconfig $interface 2> /dev/null >> /dev/null; then echo "cp_get_ifmask: $interface: No such interface" 1>&2