pccard_ether revision 63308
114596Snate#!/bin/sh -
214596Snate#
350472Speter# $FreeBSD: head/etc/pccard_ether 63308 2000-07-17 12:33:57Z ume $
438738Sbrian#
531326Snate# pccard_ether interfacename [ifconfig option]
614596Snate#
731326Snate# example: pccard_ether ep0 -link0
814596Snate#
914596Snate
1043849Sjkh# Suck in the configuration variables
1151231Ssheldonh#
1251231Ssheldonhif [ -r /etc/defaults/rc.conf ]; then
1343849Sjkh	. /etc/defaults/rc.conf
1459674Ssheldonh	source_rc_confs
1551231Ssheldonhelif [ -r /etc/rc.conf ]; then
1627117Sjkh	. /etc/rc.conf
1714596Snatefi
1814596Snate
1957144Snsayerinterface=$1
2057144Snsayershift
2157144Snsayer
2251231Ssheldonhcase ${pccard_ifconfig} in
2351231Ssheldonh[Nn][Oo] | '')
2451231Ssheldonh        ;;
2551231Ssheldonh[Dd][Hh][Cc][Pp])
2651231Ssheldonh	if [ -r /sbin/dhclient ]; then
2751231Ssheldonh		if [ -s /var/run/dhclient.pid ]; then
2831760Spst			kill `cat /var/run/dhclient.pid`
2931760Spst			rm /var/run/dhclient.pid
3031760Spst		fi
3157144Snsayer		/sbin/dhclient $interface
3251231Ssheldonh	elif [ -r /usr/local/sbin/dhcpc ]; then
3351231Ssheldonh		if [ -s /var/run/dhcpc.pid ]; then
3451231Ssheldonh			kill `cat /var/run/dhcpc.pid`
3551231Ssheldonh			rm /var/run/dhcpc.pid
3651231Ssheldonh		fi
3757144Snsayer		/usr/local/sbin/dhcpc $interface $*
3814596Snate	else
3951231Ssheldonh		echo "DHCP client software not available (isc-dhcp2)"
4014596Snate	fi
4151231Ssheldonh	;;
4251231Ssheldonh*)
4351231Ssheldonh	ifconfig ${interface} ${pccard_ifconfig} $*
4451231Ssheldonh	;;
4551231Ssheldonhesac
4631297Snate
4751231Ssheldonhcase ${defaultrouter} in
4851231Ssheldonh[Nn][Oo] | '')
4951231Ssheldonh        ;;
5051231Ssheldonh*)
5131297Snate	static_routes="default ${static_routes}"
5231297Snate	route_default="default ${defaultrouter}"
5351231Ssheldonh	;;
5451231Ssheldonhesac
5551231Ssheldonh
5631297Snate# Set up any static routes.
5751231Ssheldonh#
5850357Ssheldonhif [ -n "${static_routes}" ]; then
5931297Snate	# flush beforehand, just in case....
6031297Snate        route -n flush
6131326Snate	arp -d -a
6231297Snate	for i in ${static_routes}; do
6331297Snate		eval route_args=\$route_${i}
6431297Snate		route add ${route_args}
6531297Snate	done
6631297Snatefi
6763308Sume
6863308Sume# IPv6 setup
6963308Sumecase ${ipv6_enable} in
7063308Sume[Yy][Ee][Ss])
7163308Sume	case ${ipv6_gateway_enable} in
7263308Sume	[Yy][Ee][Ss])
7363308Sume		;;
7463308Sume	*)
7563308Sume		ifconfig ${interface} up
7663308Sume		rtsol ${interface}
7763308Sume		;;
7863308Sume	esac
7963308Sume	;;
8063308Sumeesac
81