From 1feaa9fbff1a0749b4272bd59faf4c00fc826617 Mon Sep 17 00:00:00 2001 From: marko Date: Thu, 20 Oct 2005 13:51:09 +0000 Subject: [PATCH] Fix the verification of IPv4 / IPv6 network notation. Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- editor.tcl | 1 + imunes.tcl | 4 ++-- ipv4.tcl | 4 ++-- ipv6.tcl | 4 ++-- xorp.tcl | 1 - 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/editor.tcl b/editor.tcl index 946ad13..072e596 100755 --- a/editor.tcl +++ b/editor.tcl @@ -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 } diff --git a/imunes.tcl b/imunes.tcl index ce53a76..4408aae 100755 --- a/imunes.tcl +++ b/imunes.tcl @@ -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" diff --git a/ipv4.tcl b/ipv4.tcl index c21148b..8679a93 100755 --- 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] diff --git a/ipv6.tcl b/ipv6.tcl index b90c6c6..909609a 100755 --- 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] diff --git a/xorp.tcl b/xorp.tcl index 0bd72a4..36b202c 100755 --- 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]" -- 2.39.5