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 case ${pccard_ether_delay} in
28 sleep ${pccard_ether_delay}
31 [ -n "$dhcp_program" ] && dhclient_program
="$dhcp_program"
32 [ -n "$dhcp_flags" ] && dhclient_flags
="$dhcp_flags"
33 if [ -x "${dhclient_program}" ]; then
34 if [ `basename ${dhclient_program}` = "dhclient" ]; then
35 pidfile
="/var/run/dhclient.${interface}.pid"
36 dhclient_flags
="${dhclient_flags} -pf ${pidfile}"
38 ${dhclient_program} ${dhclient_flags} ${interface}
40 echo "${dhclient_program}: DHCP client software not available"
44 # Suck in the configuration variables
46 if [ -r /etc
/defaults
/rc.conf
]; then
47 .
/etc
/defaults
/rc.conf
49 elif [ -r /etc
/rc.conf
]; then
58 case ${pccard_ifconfig} in
60 expr "${removable_interfaces}" : ".*${interface}" > /dev
/null ||
exit 0
64 eval ifconfig_
${interface}=\
${pccard_ifconfig}
69 [Ss
][Tt
][Aa
][Rr
][Tt
] |
'')
70 if ifconfig
${interface} |
grep -s UP
, > /dev
/null
2>&1; then
71 # Interface is already up, so ignore it.
75 if [ -r /etc
/start_if.
${interface} ]; then
76 .
/etc
/start_if.
${interface}
79 eval ifconfig_args
=\
$ifconfig_${interface}
80 case ${ifconfig_args} in
84 # Start up the DHCP client program
88 # Do the primary ifconfig if specified
89 ifconfig
${interface} ${ifconfig_args} $
*
91 # Check to see if aliases need to be added
95 eval ifx_args
=\
$ifconfig_${interface}_alias
${alias}
96 if [ -n "${ifx_args}" ]; then
97 ifconfig
${interface} ${ifx_args} alias
98 alias=`expr ${alias} + 1`
104 # Add default route into $static_routes
105 case ${defaultrouter} in
109 static_routes
="default ${static_routes}"
110 route_default
="default ${defaultrouter}"
114 # Add private route for this interface into $static_routes
115 eval ifx_routes
=\
$static_routes_${interface}
116 if [ -n "${ifx_routes}" ]; then
117 static_routes
="${ifx_routes} ${static_routes}"
120 # Set up any static routes if specified
121 if [ -n "${static_routes}" ]; then
122 for i
in ${static_routes}; do
123 eval route_args
=\
$route_${i}
124 route add
${route_args}
131 case ${ipv6_enable} in
133 if [ -r /etc
/network.subr
]; then
135 network6_interface_setup
${interface}
142 if [ -r /etc
/stop_if.
${interface} ]; then
143 .
/etc
/stop_if.
${interface}
146 eval ifconfig_args
=\
$ifconfig_${interface}
147 case ${ifconfig_args} in
151 # Stop the DHCP client for this interface
155 # Delete static route if specified
156 eval ifx_routes
=\
$static_routes_${interface}
157 if [ -n "${ifx_routes}" ]; then
158 for i
in ${ifx_routes}; do
159 eval route_args
=\
$route_${i}
160 route delete
${route_args}
164 # Delete aliases if exist
168 eval ifx_args
=\
$ifconfig_${interface}_alias
${alias}
169 if [ -n "${ifx_args}" ]; then
170 ifconfig
${interface} ${ifx_args} alias delete
171 alias=`expr ${alias} + 1`
179 # Remove the network interface and clean the ARP table
180 ifconfig
${interface} delete
183 # Clean the routing table
184 case ${removable_route_flush} in
188 # flush beforehand, just in case....