if { [nodeType $lnode2] == "router" || \
[nodeType $lnode2] == "frswitch" } {
return ser
+ return eth
} else {
return eth
}
proc checkIPv4Net { str } {
+ if { $str == "" } {
+ return 1
+ }
if { ![checkIPv4Addr [lindex [split $str /] 0]]} {
return 0
}
}
+proc checkIPv6Addr { str } {
+ set doublec false
+ set wordlist [split $str :]
+ set wordcnt [expr [llength $wordlist] - 1]
+ if { $wordcnt > 7 } {
+ return 0
+ }
+ if { [lindex $wordlist 0] == "" } {
+ set wordlist [lreplace $wordlist 0 0 0]
+ }
+ if { [lindex $wordlist $wordcnt] == "" } {
+ set wordlist [lreplace $wordlist $wordcnt $wordcnt 0]
+ }
+ for { set i 0 } { $i <= $wordcnt } { incr i } {
+ set word [lindex $wordlist $i]
+ if { $word == "" } {
+ if { $doublec == "true" } {
+ return 0
+ }
+ set doublec true
+ }
+ if { [string length $word] > 4 } {
+ if { $i == $wordcnt } {
+ return [checkIPv4Addr $word]
+ } else {
+ return 0
+ }
+ }
+ if { [string is xdigit $word] == 0 } {
+ return 0
+ }
+ }
+ return 1
+}
+
+
+proc checkIPv6Net { str } {
+ if { $str == "" } {
+ return 1
+ }
+ if { ![checkIPv6Addr [lindex [split $str /] 0]]} {
+ return 0
+ }
+ set net [lindex [split $str /] 1]
+ if { [string length [string trim $net]] != [string length $net] } {
+ return 0
+ }
+ return [checkIntRange $net 0 128]
+}
+
+
proc focusAndFlash {W {count 9}} {
global badentry
-validate focus -invcmd "focusAndFlash %W"
$wi.if$ifc.cfg.ipv6.addrv insert 0 \
[getIfcIPv6addr $target $ifc]
-if { 0 } {
$wi.if$ifc.cfg.ipv6.addrv configure \
- -vcmd {checkIPv4Net %P}
-}
+ -vcmd {checkIPv6Net %P}
pack $wi.if$ifc.cfg.ipv6.addrl \
$wi.if$ifc.cfg.ipv6.addrv -side left
pack $wi.if$ifc.cfg.ipv6 -side top -anchor w