#!/bin/ksh -p
# $Id: //depot/stable/explorer/tools/netinfo#2 $
#
# Explorer Version:
EXP_VERSION=4.0
#
# Source tools functions
. ${EXP_LIB}/exp_tools

# Run if specified to do so
script=${0##*/}
which_gate_exit network $script default all

get_cmd "/usr/sbin/arp -a"       netinfo/arp-a
get_cmd "/usr/bin/netstat -rvan" netinfo/netstat-rvan
get_cmd "/usr/bin/netstat -an"   netinfo/netstat-an
get_cmd "/usr/bin/netstat -pn"   netinfo/netstat-pn
get_cmd "/usr/bin/netstat -rn"   netinfo/netstat-rn
get_cmd "/usr/bin/netstat -in"   netinfo/netstat-in
get_cmd "/usr/bin/netstat -m"    netinfo/netstat-m
get_cmd "/usr/bin/netstat -s"    netinfo/netstat-s
get_cmd "/usr/bin/nfsstat"       netinfo/nfsstat
get_cmd "/usr/bin/rpcinfo"       netinfo/rpcinfo
get_cmd "/usr/bin/rpcinfo -m"    netinfo/rpcinfo-m

# get /etc/net/*/hosts files
get_file "/etc/net/ticlts/hosts"     netinfo/ticlts-hosts
get_file "/etc/net/ticots/hosts"     netinfo/ticots-hosts
get_file "/etc/net/ticotsord/hosts"  netinfo/ticotsord-hosts

# use netstat -k (undocumented) or kstat -p (solaris 8 and higher)
REV=`uname -r | nawk -F. '{ print $2 }'`
if [ "${REV}" -lt 8 ]
then
    # COMMENTED OUT due to SunAlert 27552
    # get_cmd "/usr/bin/netstat -k" netinfo/netstat-k
    # Need noop until netstat -k can be uncommented
    :
else
    get_cmd "/usr/bin/kstat -p" netinfo/kstat-p
fi

# Get DNS config
get_file /etc/named.conf netinfo

# Check FireWall-1 version
get_cmd "/etc/fw/bin/fw ver" netinfo/firewall-1_fw_ver

# Check for NIS+
NIS=`ls -l /var/nis/* 2>/dev/null | wc -l`
if [ ${NIS} -gt 0 ]
then
    domain=`domainname`
    get_cmd "/usr/bin/nisdefaults"              netinfo/
    get_cmd "/usr/lib/nis/nisshowcache -v"      netinfo/nisshowcache-v
    get_cmd "/usr/bin/niscat -o $domain"        netinfo/niscat-o_$domain
    get_cmd "/usr/lib/nis/nisping -u org_dir"   netinfo/nisping-u
    get_cmd "/usr/lib/nis/nisstat"              netinfo/nisstat
    get_cmd "/usr/bin/nisls -lR"                netinfo/nisls-lR
    get_cmd "/usr/bin/niscat -o passwd.org_dir" netinfo/niscat-o_passwd.org_dir
fi
