1996-03-12 15:39:26 +00:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
1998-09-02 01:34:57 +00:00
|
|
|
#
|
2000-10-16 19:11:11 +00:00
|
|
|
# pccard_ether interfacename [start|stop] [ifconfig option]
|
1996-03-12 15:39:26 +00:00
|
|
|
#
|
2000-10-16 19:11:11 +00:00
|
|
|
# example: pccard_ether ep0 start -link0
|
1996-03-12 15:39:26 +00:00
|
|
|
#
|
|
|
|
|
2000-10-16 19:11:11 +00:00
|
|
|
stop_dhcp() {
|
|
|
|
if [ -r /sbin/dhclient ]; then
|
|
|
|
pidfile="/var/run/dhclient.${interface}.pid"
|
|
|
|
if [ -s ${pidfile} ]; then
|
|
|
|
kill `cat ${pidfile}`
|
|
|
|
rm ${pidfile}
|
|
|
|
fi
|
|
|
|
elif [ -r /usr/local/sbin/dhcpc ]; then
|
|
|
|
pidfile="/var/run/dhcpc.${interface}.pid"
|
|
|
|
if [ -s ${pidfile} ]; then
|
|
|
|
kill `cat ${pidfile}`
|
|
|
|
rm ${pidfile}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
start_dhcp() {
|
|
|
|
stop_dhcp
|
|
|
|
if [ -r /sbin/dhclient ]; then
|
|
|
|
pidfile="/var/run/dhclient.${interface}.pid"
|
|
|
|
/sbin/dhclient -pf ${pidfile} $interface
|
|
|
|
elif [ -r /usr/local/sbin/dhcpc ]; then
|
|
|
|
/usr/local/sbin/dhcpc $interface
|
|
|
|
else
|
|
|
|
echo "DHCP client software not available (isc-dhcp2)"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
1999-02-10 18:08:16 +00:00
|
|
|
# Suck in the configuration variables
|
1999-09-13 15:44:20 +00:00
|
|
|
#
|
|
|
|
if [ -r /etc/defaults/rc.conf ]; then
|
1999-02-10 18:08:16 +00:00
|
|
|
. /etc/defaults/rc.conf
|
2000-04-27 08:43:49 +00:00
|
|
|
source_rc_confs
|
1999-09-13 15:44:20 +00:00
|
|
|
elif [ -r /etc/rc.conf ]; then
|
1997-06-30 19:10:50 +00:00
|
|
|
. /etc/rc.conf
|
1996-03-12 15:39:26 +00:00
|
|
|
fi
|
|
|
|
|
2000-02-11 14:49:42 +00:00
|
|
|
interface=$1
|
|
|
|
shift
|
2000-10-16 19:11:11 +00:00
|
|
|
startstop=$2
|
|
|
|
shift
|
2000-02-11 14:49:42 +00:00
|
|
|
|
2000-10-16 19:11:11 +00:00
|
|
|
case ${startstop} in
|
|
|
|
[Ss][Tt][Aa][Rr][Tt] | '')
|
|
|
|
case ${pccard_ifconfig} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
[Dd][Hh][Cc][Pp])
|
|
|
|
start_dhcp
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ifconfig ${interface} ${pccard_ifconfig} $*
|
|
|
|
;;
|
|
|
|
esac
|
1997-11-19 18:51:25 +00:00
|
|
|
|
2000-10-16 19:11:11 +00:00
|
|
|
case ${defaultrouter} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
static_routes="default ${static_routes}"
|
|
|
|
route_default="default ${defaultrouter}"
|
|
|
|
;;
|
|
|
|
esac
|
1999-09-13 15:44:20 +00:00
|
|
|
|
2000-10-16 19:11:11 +00:00
|
|
|
# Set up any static routes.
|
|
|
|
#
|
|
|
|
if [ -n "${static_routes}" ]; then
|
|
|
|
# flush beforehand, just in case....
|
|
|
|
route -n flush
|
|
|
|
arp -d -a
|
|
|
|
for i in ${static_routes}; do
|
|
|
|
eval route_args=\$route_${i}
|
|
|
|
route add ${route_args}
|
|
|
|
done
|
|
|
|
fi
|
2000-07-17 12:33:57 +00:00
|
|
|
|
2000-10-16 19:11:11 +00:00
|
|
|
# IPv6 setup
|
|
|
|
case ${ipv6_enable} in
|
2000-07-17 12:33:57 +00:00
|
|
|
[Yy][Ee][Ss])
|
2000-10-16 19:11:11 +00:00
|
|
|
case ${ipv6_gateway_enable} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
sysctl -w net.inet6.ip6.forwarding=0
|
|
|
|
sysctl -w net.inet6.ip6.accept_rtadv=1
|
|
|
|
ifconfig ${interface} up
|
|
|
|
rtsol ${interface}
|
|
|
|
;;
|
|
|
|
esac
|
2000-07-17 12:33:57 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2000-10-16 19:11:11 +00:00
|
|
|
# Stop the interface
|
|
|
|
*)
|
|
|
|
/sbin/ifconfig $device delete
|
|
|
|
stop_dhcp
|
|
|
|
;;
|
2000-07-17 12:33:57 +00:00
|
|
|
esac
|