3 # $FreeBSD: src/etc/pccard_ether,v 1.15.2.10 2001/09/14 17:28:11 imp Exp $
5 # pccard_ether interfacename [start|stop] [ifconfig option]
7 # example: pccard_ether ep0 start -link0
11 if [ -s /var/run/dhclient.${interface}.pid ]; then
12 pidfile="/var/run/dhclient.${interface}.pid"
13 elif [ -s /var/run/dhcpc.${interface}.pid ]; then
14 pidfile="/var/run/dhcpc.${interface}.pid"
24 if [ -x "${dhcp_program}" ]; then
25 if [ `basename ${dhcp_program}` = "dhclient" ]; then
26 pidfile="/var/run/dhclient.${interface}.pid"
27 dhcp_flags="${dhcp_flags} -pf ${pidfile}"
29 ${dhcp_program} ${dhcp_flags} ${interface}
31 echo "${dhcp_program}: DHCP client software not available"
35 # Suck in the configuration variables
37 if [ -r /etc/defaults/rc.conf ]; then
38 . /etc/defaults/rc.conf
40 elif [ -r /etc/rc.conf ]; then
49 case ${pccard_ether_delay} in
53 sleep ${pccard_ether_delay}
55 *) # Default until it has had a chance to make it to /etc/defaults/rc.conf
60 case ${pccard_ifconfig} in
65 eval ifconfig_${interface}=\${pccard_ifconfig}
70 [Ss][Tt][Aa][Rr][Tt] | '')
71 if [ -r /etc/start_if.${interface} ]; then
72 . /etc/start_if.${interface}
75 eval ifconfig_args=\$ifconfig_${interface}
76 case ${ifconfig_args} in
80 # Start up the DHCP client program
84 # Do the primary ifconfig if specified
85 ifconfig ${interface} ${ifconfig_args} $*
87 # Check to see if aliases need to be added
91 eval ifx_args=\$ifconfig_${interface}_alias${alias}
92 if [ -n "${ifx_args}" ]; then
93 ifconfig ${interface} ${ifx_args} alias
94 alias=`expr ${alias} + 1`
100 # Do ipx address if specified
101 eval ifx_args=\$ifconfig_${interface}_ipx
102 if [ -n "${ifx_args}" ]; then
103 ifconfig ${interface} ${ifx_args}
106 # Add default route into $static_routes
107 case ${defaultrouter} in
111 static_routes="default ${static_routes}"
112 route_default="default ${defaultrouter}"
116 # Add private route for this interface into $static_routes
117 eval ifx_routes=\$static_routes_${interface}
118 if [ -n "${ifx_routes}" ]; then
119 static_routes="${ifx_routes} ${static_routes}"
122 # Set up any static routes if specified
123 if [ -n "${static_routes}" ]; then
124 for i in ${static_routes}; do
125 eval route_args=\$route_${i}
126 route add ${route_args}
133 case ${ipv6_enable} in
135 if [ -r /etc/rc.network6 ]; then
137 network6_interface_setup ${interface}
144 if [ -r /etc/stop_if.${interface} ]; then
145 . /etc/stop_if.${interface}
148 eval ifconfig_args=\$ifconfig_${interface}
149 case ${ifconfig_args} in
153 # Stop the DHCP client for this interface
157 # Delelte static route if specified
158 eval ifx_routes=\$static_routes_${interface}
159 if [ -n "${ifx_routes}" ]; then
160 for i in ${ifx_routes}; do
161 eval route_args=\$route_${i}
162 route delete ${route_args}
166 # Delete aliases if exist
170 eval ifx_args=\$ifconfig_${interface}_alias${alias}
171 if [ -n "${ifx_args}" ]; then
172 ifconfig ${interface} ${ifx_args} alias delete
173 alias=`expr ${alias} + 1`
181 # Remove the network interface and clean the ARP table
182 ifconfig ${interface} delete