]> git.entuzijast.net Git - imunes.git/commitdiff
New procedures hasIPv4Addr{} and hasIPv6Addr{} - return true if
authormarko <marko>
Tue, 12 Jul 2005 07:30:24 +0000 (07:30 +0000)
committermarko <marko>
Tue, 12 Jul 2005 07:30:24 +0000 (07:30 +0000)
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:

nodecfg.tcl

index 55778d99319cb0bf8575e49276063dc06449ba41..975fa87333cfc2dc0524a0f268183fc29670f511 100755 (executable)
 # 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
 #