freebsd-dev/etc/pccard_ether
Nick Sayer ad2a9d04d1 When running dhclient on a PC-Card insertion, specify the inserted
interface on the dhclient command line. Not doing so screws up vmware's
network interface by attempting to configure it for DHCP (which will
never work, of course). It also would impact any other interface that
may be present that, again, would likely be manually configured for
some other purpose.

Approved by: jkh
2000-02-11 14:49:42 +00:00

66 lines
1.2 KiB
Bash
Executable File

#!/bin/sh -
#
# $FreeBSD$
#
# pccard_ether interfacename [ifconfig option]
#
# example: pccard_ether ep0 -link0
#
# Suck in the configuration variables
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
interface=$1
shift
case ${pccard_ifconfig} in
[Nn][Oo] | '')
;;
[Dd][Hh][Cc][Pp])
if [ -r /sbin/dhclient ]; then
if [ -s /var/run/dhclient.pid ]; then
kill `cat /var/run/dhclient.pid`
rm /var/run/dhclient.pid
fi
/sbin/dhclient $interface
elif [ -r /usr/local/sbin/dhcpc ]; then
if [ -s /var/run/dhcpc.pid ]; then
kill `cat /var/run/dhcpc.pid`
rm /var/run/dhcpc.pid
fi
/usr/local/sbin/dhcpc $interface $*
else
echo "DHCP client software not available (isc-dhcp2)"
fi
;;
*)
ifconfig ${interface} ${pccard_ifconfig} $*
;;
esac
case ${defaultrouter} in
[Nn][Oo] | '')
;;
*)
static_routes="default ${static_routes}"
route_default="default ${defaultrouter}"
;;
esac
# 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