#----------------------------------------------------------------------------
# /etc/rc.d/rc305.ip-eth - ip configuration of ethernet cards
# /etc/rc.d/ip-eth
#
# Creation:         04.02.2001  fm
# Last Update:  $Id: rc305.ip-eth 10021 2005-10-18 22:34:22Z felix $
#----------------------------------------------------------------------------

begin_script IP_NET "configuring ip on network cards ..."

for idx in `seq 1 $IP_NET_N`
do
    eval dev='$IP_NET_'$idx'_DEV'
    eval mac='$IP_NET_'$idx'_MAC'
    eval net='$IP_NET_'$idx''

    # leave mac as is, unless otherwise configured
    if [ -n "$mac" ]
    then
      ifconfig $dev hw ether $mac
    fi

    # if no ip address, skip configuration
    if [ -n "$net" ]
    then
      ipaddr=`echo $net | sed -e 's/\/.*//'`
      netmask=`netcalc netmask $net`
      broadcast=`netcalc broadcast $net`

      ifconfig $dev $ipaddr netmask $netmask broadcast $broadcast
    fi
done

end_script
