]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/net.sh
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 27 Jun 2019 14:20:44 +0000 (15:20 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 27 Jun 2019 14:20:44 +0000 (15:20 +0100)
etc/profile.d/net.sh

index cedcff9cfc8137506f32a655ea6e5fd7038a6493..106d6dfbfbc60e5dea40ae864e7847b5461cbe40 100644 (file)
@@ -50,7 +50,7 @@ net_mask2cdr() {
         echo $(( $2 + (${#x}/4) ))
 }
 
-net_host_ip() {
+net_resolve_ip() {
        host -s "$1" | awk '/has address/{print $4; exit}'
 }
 
@@ -58,7 +58,7 @@ net_is_local() {
        declare ip="${1:?Usage: net_is_local IP|HOST}"
        case "$ip" in
                [0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?) [ 1 ];;
-               *) ip="$(net_host_ip "$ip")"
+               *) ip="$(net_resolve_ip "$ip")"
        esac
 
        [ -n "$ip" ] || return 2