From: marko Date: Tue, 12 Jul 2005 07:30:24 +0000 (+0000) Subject: New procedures hasIPv4Addr{} and hasIPv6Addr{} - return true if X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=8e8f4e9b7747a32e633926ce9efefe3c38367561;p=imunes.git New procedures hasIPv4Addr{} and hasIPv6Addr{} - return true if at least one interface has an IPv{4|6} address configured, otherwise return false. Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- diff --git a/nodecfg.tcl b/nodecfg.tcl index 55778d9..975fa87 100755 --- a/nodecfg.tcl +++ b/nodecfg.tcl @@ -187,6 +187,11 @@ # ifcByPeer { local_node_id peer_node_id } # Returns the name of the interface connected to the specified peer. # +# hasIPv4Addr { node_id } +# hasIPv6Addr { node_id } +# Retruns true if at least one interface has an IPv{4|6} address +# configured, otherwise returns false. +# # All of the above functions are independent to any Tk objects. This means # they can be used for implementing tasks external to GUI, so inside the # GUI any updating of related Tk objects (such as text labels etc.) will @@ -729,6 +734,26 @@ proc ifcByPeer { node peer } { } +proc hasIPv4Addr { node } { + foreach ifc [ifcList $node] { + if { [getIfcIPv4addr $node $ifc] != "" } { + return true + } + } + return false +} + + +proc hasIPv6Addr { node } { + foreach ifc [ifcList $node] { + if { [getIfcIPv6addr $node $ifc] != "" } { + return true + } + } + return false +} + + # # The following should really go into a separate "editing" library #