3 # $FreeBSD: src/etc/pccard_ether,v 1.15.2.10 2001/09/14 17:28:11 imp Exp $
4 # $DragonFly: src/etc/pccard_ether,v 1.4 2003/10/09 17:39:36 dillon Exp $
6 # pccard_ether interfacename [start|stop] [ifconfig option]
8 # example: pccard_ether ep0 start -link0
12 if [ -s /var
/run
/dhclient.
${interface}.pid
]; then
13 pidfile
="/var/run/dhclient.${interface}.pid"
14 elif [ -s /var
/run
/dhcpc.
${interface}.pid
]; then
15 pidfile
="/var/run/dhcpc.${interface}.pid"
25 case ${pccard_ether_delay} in
29 sleep ${pccard_ether_delay}
32 [ -n "$dhcp_program" ] && dhclient_program
="$dhcp_program"
33 [ -n "$dhcp_flags" ] && dhclient_flags
="$dhcp_flags"
34 if [ -x "${dhclient_program}" ]; then
35 if [ `basename ${dhclient_program}` = "dhclient" ]; then
36 pidfile
="/var/run/dhclient.${interface}.pid"
37 dhclient_flags
="${dhclient_flags} -pf ${pidfile}"
39 ${dhclient_program} ${dhclient_flags} ${interface}
41 echo "${dhclient_program}: DHCP client software not available"
45 # Suck in the configuration variables
47 if [ -r /etc
/defaults
/rc.conf
]; then
48 .
/etc
/defaults
/rc.conf
50 elif [ -r /etc
/rc.conf
]; then
59 case ${pccard_ifconfig} in
61 expr "${removable_interfaces}" : ".*${interface}" > /dev
/null ||
exit 0
65 eval ifconfig_
${interface}=\
${pccard_ifconfig}
70 [Ss
][Tt
][Aa
][Rr
][Tt
] |
'')
71 if ifconfig
${interface} |
grep -s UP
, > /dev
/null
2>&1; then
72 # Interface is already up, so ignore it.
76 if [ -r /etc
/start_if.
${interface} ]; then
77 .
/etc
/start_if.
${interface}
80 eval ifconfig_args
=\
$ifconfig_${interface}
81 case ${ifconfig_args} in
85 # Start up the DHCP client program
89 # Do the primary ifconfig if specified
90 ifconfig
${interface} ${ifconfig_args} $
*
92 # Check to see if aliases need to be added
96 eval ifx_args
=\
$ifconfig_${interface}_alias
${alias}
97 if [ -n "${ifx_args}" ]; then
98 ifconfig
${interface} ${ifx_args} alias
99 alias=`expr ${alias} + 1`
105 # Do ipx address if specified
106 eval ifx_args
=\
$ifconfig_${interface}_ipx
107 if [ -n "${ifx_args}" ]; then
108 ifconfig
${interface} ${ifx_args}
111 # Add default route into $static_routes
112 case ${defaultrouter} in
116 static_routes
="default ${static_routes}"
117 route_default
="default ${defaultrouter}"
121 # Add private route for this interface into $static_routes
122 eval ifx_routes
=\
$static_routes_${interface}
123 if [ -n "${ifx_routes}" ]; then
124 static_routes
="${ifx_routes} ${static_routes}"
127 # Set up any static routes if specified
128 if [ -n "${static_routes}" ]; then
129 for i
in ${static_routes}; do
130 eval route_args
=\
$route_${i}
131 route add
${route_args}
138 case ${ipv6_enable} in
140 if [ -r /etc
/network.subr
]; then
142 network6_interface_setup
${interface}
149 if [ -r /etc
/stop_if.
${interface} ]; then
150 .
/etc
/stop_if.
${interface}
153 eval ifconfig_args
=\
$ifconfig_${interface}
154 case ${ifconfig_args} in
158 # Stop the DHCP client for this interface
162 # Delete static route if specified
163 eval ifx_routes
=\
$static_routes_${interface}
164 if [ -n "${ifx_routes}" ]; then
165 for i
in ${ifx_routes}; do
166 eval route_args
=\
$route_${i}
167 route delete
${route_args}
171 # Delete aliases if exist
175 eval ifx_args
=\
$ifconfig_${interface}_alias
${alias}
176 if [ -n "${ifx_args}" ]; then
177 ifconfig
${interface} ${ifx_args} alias delete
178 alias=`expr ${alias} + 1`
186 # Remove the network interface and clean the ARP table
187 ifconfig
${interface} delete
190 # Clean the routing table
191 case ${removable_route_flush} in
195 # flush beforehand, just in case....