#!/bin/sh # # $FreeBSD: src/etc/rc.d/network1,v 1.147 2003/06/06 13:00:43 mtm Exp $ # $DragonFly: src/etc/rc.d/Attic/network1,v 1.4 2005/04/15 18:40:52 joerg Exp $ # # PROVIDE: network1 # REQUIRE: atm1 ipfilter mountcritlocal serial sppp sysctl tty # KEYWORD: DragonFly nostart . /etc/rc.subr name="network1" start_cmd="network_start" stop_cmd="network_stop" network_gif_setup() { case ${gif_interfaces} in [Nn][Oo] | '') ;; *) for i in ${gif_interfaces}; do eval peers=\$gifconfig_$i case ${peers} in '') continue ;; *) ifconfig $i create >/dev/null 2>&1 ifconfig $i tunnel ${peers} ifconfig $i up ;; esac done ;; esac } network_start() { # set hostname, turn on network # echo -n "Doing initial network setup:" # Set the host name if it is not already set # if [ -z "`hostname -s`" ]; then hostname ${hostname} echo -n ' hostname' fi # Set the domainname if we're using NIS # case ${nisdomainname} in [Nn][Oo]|'') ;; *) domainname ${nisdomainname} echo -n ' domain' ;; esac echo '.' # Attempt to create cloned interfaces. for ifn in ${cloned_interfaces}; do ifconfig ${ifn} create done # gifconfig network_gif_setup # Set up all the network interfaces, calling startup scripts if needed # case ${network_interfaces} in [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; *) network_interfaces="${network_interfaces} ${cloned_interfaces}" ;; esac dhcp_interfaces="" for ifn in ${network_interfaces}; do if [ -r /etc/start_if.${ifn} ]; then . /etc/start_if.${ifn} eval showstat_$ifn=1 fi # Do the primary ifconfig if specified # eval ifconfig_args=\$ifconfig_${ifn} case ${ifconfig_args} in '') ;; [Dd][Hh][Cc][Pp]) # DHCP inits are done all in one go below dhcp_interfaces="$dhcp_interfaces $ifn" eval showstat_$ifn=1 ;; *) ifconfig ${ifn} ${ifconfig_args} eval showstat_$ifn=1 ;; esac done if [ ! -z "${dhcp_interfaces}" ]; then ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} fi for ifn in ${network_interfaces}; do # Check to see if aliases need to be added # alias=0 while : ; do eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} alias eval showstat_$ifn=1 alias=$((${alias} + 1)) else break; fi done # Do ipx address if specified # eval ifconfig_args=\$ifconfig_${ifn}_ipx if [ -n "${ifconfig_args}" ]; then ifconfig ${ifn} ${ifconfig_args} eval showstat_$ifn=1 fi done # Display ifconfiged interfaces for ifn in ${network_interfaces}; do eval showstat=\$showstat_${ifn} if [ ! -z ${showstat} ]; then ifconfig ${ifn} fi done # Resync ipfilter /etc/rc.d/ipfilter resync } network_stop() { echo -n "Stopping network:" # flush routes # echo -n " flush routes" route -n flush echo '.' } load_rc_config $name run_rc_command "$1"