[tkined] ip_discover.tcl questions (was: Network and subnet)

Matthew Levine (mlevine@cisco.com)
Tue, 17 Aug 1999 13:03:35 -0700

Hi,

Okay, I have the ip_discover.tcl script now using subnet masks. Boy!
That's so much nicer.

Now I have a couple of questions about the rest of the script.

First, the script was meant to work with network numbers like 192.168.1
or 172.16. I've changed that in netping and discover_nodes but when I
changed it in discover_networks, tkined didn't map the networks
correctly. Should I not touch this? Maybe just change how its
displayed on the map?

Relevant code:

switch $class {
A { set bytes [lrange [split $ip .] 0 0]; set mmm
"255.0.0.0" }
B { set bytes [lrange [split $ip .] 0 1]; set mmm
"255.255.0.0" }
C { set bytes [lrange [split $ip .] 0 2]; set mmm
"255.255.255.0" }
D { set bytes "" }
}
set net [join $bytes .]

Also, can someone tell me what this sanity check in discover_networks
does?

# Sanity check for incorrect netmasks. Netmasks wider than
# the official network type don't make any sense. Ignore
# problems that are due to the loopback mask of the localhost.

if {$netmask == "0.0.0.0"} continue;
if { [ip_network $net $netmask] != $net } {
if {![catch {nslook [exec hostname]} localhost]} {
if {[string trim $localhost] == $ip} continue
}
set txt "Please check the netmask $netmask for $ip on class
$class n
etwork $net."
ined acknowledge $txt

Netmasks wider than the official network type are very common. Many of
the networks I work with are Class B addresses with 24 to 27 bits for
the network portion (extended by 8 to 11 bits).

Thanks,
Matthew

-- 
---
------
Matthew Levine
Development Test (Consumer Line Of Business)
Cisco Systems, Santa Cruz	http://www.cisco.com/
mlevine@cisco.com	(831) 457 - 5431
--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.