home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
nwnet
/
root
/
usr
/
lib
/
netcfg
/
bin
/
ipx.chk
/
ipx
Wrap
Text File
|
1998-08-19
|
4KB
|
154 lines
#!/bin/osavtcl
#
# Copyright (C) 1997, The Santa Cruz Operation, Inc.
# All Rights Reserved.
#
# The information in this file is provided for the exclusive use of
# the licensees of The Santa Cruz Operation, Inc. Such users have the
# right to use, modify, and incorporate this code into other products
# for purposes authorized by the license agreement provided they include
# this notice and the associated copyright notice with any such product.
# The information in this file is provided "AS IS" without warranty.
#
#ident "@(#)ipx.chk 1.2"
#
# verify that the state information in /etc/chains
# refering to ipx configuration is up to date with the
# state information in /etc/netware/nwconfig
#
source /usr/lib/netcfg/bin/ipx.fn
#cmdtrace on
proc DoExit {cbs} {
keylget cbs dialog dialog
VtClose
exit 0
}
# WindowWarning a suitable warning with the give message
#
proc WindowWarning { warning } {
# echo $warning
set parent [VtOpen plopGUI ""]
VtShowDialog [VtWarningDialog $parent.err -ok \
-okCallback DoExit \
-message $warning]
VtUnLock
VtMainLoop
}
# VerifyIpxChain {chain nic}
# Verifies netcfg:ipx chains
#
proc VerifyIpxChain { chain nic } {
set num [ FindIpxLanNumber adapter /dev/$nic ]
if { $num == 0 } {
#
# netware configuration doesn't know about this chain
WindowWarning \
"Netcfg and nwcm configurations are not synchronised.\n\n\
Netcfg is configured with the chain $chain. The device\n\
cannot be identified in the netware configuration file.\n\
Please rectify the situation before continuing."
}
}
# VerifyIpxNwipChain { elem chain }
# Verifies and if necessary removes part of the chain
# running nwip from netcfg
#
proc VerifyIpxNwipChain {elem chain} {
set num [ FindIpxLanNumber adapter /dev/nwip ]
if { $num == 0 } {
#
# netware configuration doesn't know about this
# chain
WindowWarning \
"Netcfg and nwcm configurations are not synchronised.\n\n\
Netcfg is configured with the chain $chain.\n\
In the netware configuration this should be identifiable\n\
as an adapter set to /dev/nwip. Please rectify the \n\
situation before continuing."
}
}
# Check the chains that netcfg knows about and
# verify that nwcm knows about them.
# And vice verca.
# And print warnings when necessary
#
proc IpxCheckChains {} {
global MAXLAN
set chains [ exec cat /usr/lib/netcfg/chains ]
foreach chain $chains {
set elems [ split $chain # ]
set nelem [ llength $elems ]
set nic [ lindex $elems [ expr $nelem - 1 ] ]
for { set n 0 } { $n < [ expr $nelem - 1 ] } { incr n } {
if [ cequal [ lindex $elems $n ] ipx ] {
# found a chain involving ipx
if [ cequal $nic "tcp" ] {
VerifyIpxNwipChain ipx $chain
} else {
VerifyIpxChain $chain $nic
}
}
}
}
# Check the devices nwcm knows about and
# check that netcfg has them
for { set i 1 } { $i < [ expr $MAXLAN + 1 ] } { incr i } {
set adap [ GetNwcmParam lan_${i}_adapter ]
set tmp [ split $adap / ]
set dev [ lindex $tmp 2 ]
if { [ cequal ${dev} "nwip" ] } {
set found 0
foreach chain $chains {
if { [ string first "ipx#tcp" $chain ] != -1 } {
set found 1
break
}
}
if { $found == 0 } {
WindowWarning \
"Netcfg and nwcm configurations are not synchronised.\n\n\
Netware is configured to use the device $adap.\n\
Netcfg does not know about this chain (it should\n\
appear as ipx running over tcp). Please rectify\n\
the situation before continuing."
}
} elseif { ! [ cequal $dev "" ] } {
set found 0
foreach chain $chains {
if { [ string first "ipx#$dev" $chain ] != -1 } {
set found 1
break
}
}
if { $found == 0 } {
WindowWarning \
"Netcfg and nwcm configurations are not synchronised.\n\n\
Netware is configured to use the device $adap\n\
Netcfg does not know about this chain. Please\n\
rectify the situation before continuing."
}
}
}
}
# main
IpxCheckChains