
#-----------------------------------------------------------------------
# Copyright (C) 2000-2001, Jean-Sebastien Morisset <jsmoriss@mvlan.net>
#-----------------------------------------------------------------------
# $Id: set_default_vars.sh,v 1.4 2001/08/11 17:01:20 jsmoriss Exp $
#-----------------------------------------------------------------------
#  $RCSfile: set_default_vars.sh,v $
#   $Author: jsmoriss $
# $Revision: 1.4 $
#     $Date: 2001/08/11 17:01:20 $
#   $Locker:  $ 
#     $Name:  $
#-----------------------------------------------------------------------
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by 
# the Free Software Foundation <http://www.gnu.org/copyleft/gpl.txt>.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License (LICENSE file in archive) for more details.
#
#-----------------------------------------------------------------------
# README
#-----------------------------------------------------------------------
#
# A bourne shell function used by rcf; a very secure, fast, and complete
# firewall for linux <http://jsmoriss.mvlan.net/linux/rcf.html>.
#
# Try to determine the private and public interfaces.
#
#-----------------------------------------------------------------------
# FUNCTION
#-----------------------------------------------------------------------

Set_Default_Vars () {
	
	ALL_INTERFACES="`All_Interfaces|grep -v 'lo'`"

	for INTERFACE in $ALL_INTERFACES
	do
		IPADDR="`Interface_Addr ${INTERFACE}`"
		case $IPADDR in
			10.*|172.16.*|192.168.*)
				[ ! "$PRIVATE_INTERFACES" ] \
					&& PRIVATE_INTERFACES="$INTERFACE" \
					|| PRIVATE_INTERFACES="$PRIVATE_INTERFACES $INTERFACE"
				;;
			*)
				[ ! "$PUBLIC_INTERFACES" ] \
					&& PUBLIC_INTERFACES="$INTERFACE" \
					|| PUBLIC_INTERFACES="$PUBLIC_INTERFACES $INTERFACE"
				;;
		esac
	done
}

