#!/sbin/sh

#
# @(#)plumbSunScreen.sh	3.7 03/01/99 Sun Microsystems
#
# Plumb the SunScreen module on EFS style interfaces before they are turned on
# by the rootusr script.  This only plumbs the EFS style interfaces which have
# corresponding /etc/hostname.XXX files as those are the ones that would
# normally be plumbed by the rootusr script.  Any other EFS style interfaces
# must be plumbed by some other means.  Any SPF style interfaces are plumbed at
# activate time.
#

#
# Get the list of network interfaces to configure by breaking /etc/hostname.*
# into separate args by using "." as a shell separator character, then stepping
# through pairs of args.  Run "ifconfig plumb" and ss_plumb_interface on each
# interface.  This sets up the streams plumbing for the interface, both the
# "regular" IP stack and the SunScreen module.
#
if [ -f /etc/opt/SUNWicg/SunScreen/.active/Interface.in ]
then
    interface_names="`echo /etc/hostname.*[!:][0-9] 2>/dev/null`"
    if [ "$interface_names" != "/etc/hostname.*[!:][0-9]" ]
    then
	echo "plumbing SunScreen network interfaces:\c"
	IFS="$IFS."
	set -- `echo /etc/hostname\.*[!:][0-9]`
	while test $# -ge 2
	do shift
	   if [ "$1" != "xx0" ]
	   then /sbin/ifconfig $1 plumb
		/sbin/ss_plumb_interface $1
		echo " $1\c"
	   fi
	   shift
	done
	echo "."
    fi
fi
