]> git.entuzijast.net Git - imunes.git/commitdiff
Fix the verification of IPv4 / IPv6 network notation.
authormarko <marko>
Thu, 20 Oct 2005 13:51:09 +0000 (13:51 +0000)
committermarko <marko>
Thu, 20 Oct 2005 13:51:09 +0000 (13:51 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

editor.tcl
imunes.tcl
ipv4.tcl
ipv6.tcl
xorp.tcl

index 946ad1370dedd7ac9ca6716edb5c22fe7ea10e8d..072e596e3c6327eeb8e8d17ab6e5a786acffa21e 100755 (executable)
@@ -899,6 +899,7 @@ proc checkIntRange { str low high } {
     if { $str == "" } {
        return 1
     }
+    set str [string trimleft $str 0]
     if { ![string is integer $str] } {
        return 0
     }
index ce53a761a278fea2a09510bf02d502482207d662..4408aaed87b75878a8fdb18d3a88ea40ea461872 100755 (executable)
@@ -49,8 +49,8 @@ if {[lindex $argv 0] == "-b" || [lindex $argv 0] == "--batch"} {
 # value by the installation script.
 #
 
-set LIBDIR lib/imunes
-set ROOTDIR /usr/local
+set LIBDIR ""
+set ROOTDIR "."
 
 source "$ROOTDIR/$LIBDIR/linkcfg.tcl"
 source "$ROOTDIR/$LIBDIR/nodecfg.tcl"
index c21148bcad4546f0cc8e2cae7fd407f67c4507e5..8679a93550765c97a51b002bd4ea89ce5a65cf94 100755 (executable)
--- a/ipv4.tcl
+++ b/ipv4.tcl
@@ -158,8 +158,8 @@ proc checkIPv4Net { str } {
     if { ![checkIPv4Addr [lindex [split $str /] 0]]} {
         return 0
     }
-    set net [lindex [split $str /] 1]
-    if { [string length [string trim $net]] != [string length $net] } {
+    set net [string trim [lindex [split $str /] 1]]
+    if { [string length $net] == 0 } {
         return 0
     }
     return [checkIntRange $net 0 32]
index b90c6c689280a87a780ffe758c268793f8d0e0ce..909609a2af291661a4c88abc909c360e36297431 100755 (executable)
--- a/ipv6.tcl
+++ b/ipv6.tcl
@@ -137,8 +137,8 @@ proc checkIPv6Net { str } {
     if { ![checkIPv6Addr [lindex [split $str /] 0]]} {
         return 0
     }
-    set net [lindex [split $str /] 1]
-    if { [string length [string trim $net]] != [string length $net] } {
+    set net [string trim [lindex [split $str /] 1]]
+    if { [string length $net] == 0 } {
         return 0
     }
     return [checkIntRange $net 0 128]
index 0bd72a495e1bae99c11c169dbeb66d28139b379a..36b202c763c573fc5801d1b368aa574f899b8c67 100755 (executable)
--- a/xorp.tcl
+++ b/xorp.tcl
@@ -124,7 +124,6 @@ proc $MODULE.cfggen { node } {
        lappend cfg "protocols {"
        lappend cfg "    ripng {"
        lappend cfg "   /* export: \"connected\" */"
-       lappend cfg "   }"
        lappend cfg ""
        foreach ifc [ifcList $node] {
            set addr "[lindex [split [getIfcIPv6addr $node $ifc] /] 0]"