kernel - Implement sbrk(), change low-address mmap hinting
[dragonfly.git] / etc / pccard_ether
blobb48eaa53326a06f9d5ced8cc840c52fb02dfdd45
1 #!/bin/sh -
3 # $FreeBSD: head/libexec/rc/pccard_ether 339413 2018-10-17 16:49:11Z bz $
5 # pccard_ether interfacename [start|stop|restart]
7 # example: pccard_ether fxp0 start
10 . /etc/rc.subr
11 . /etc/network.subr
13 name="pccard_ether"
14 start_cmd="pccard_ether_start"
15 stop_cmd="pccard_ether_stop"
16 restart_cmd="pccard_ether_restart"
17 startchildren_cmd="pccard_ether_startchildren"
18 stopchildren_cmd="pccard_ether_stopchildren"
19 extra_commands="startchildren stopchildren"
21 setup_routes()
23 # Add default route into $static_routes
24 case ${defaultrouter} in
25 [Nn][Oo] | '')
28 static_routes="default ${static_routes}"
29 route_default="default ${defaultrouter}"
31 esac
33 # Add private route for this interface into $static_routes
34 eval ifx_routes=\$static_routes_${ifn}
35 if [ -n "${ifx_routes}" ]; then
36 static_routes="${ifx_routes} ${static_routes}"
39 # Set up any static routes if specified
40 if [ -n "${static_routes}" ]; then
41 for i in ${static_routes}; do
42 eval route_args=\$route_${i}
43 route add ${route_args}
44 done
48 remove_routes()
50 # Delete static route if specified
51 eval ifx_routes=\$static_routes_${ifn}
52 if [ -n "${ifx_routes}" ]; then
53 for i in ${ifx_routes}; do
54 eval route_args=\$route_${i}
55 route delete ${route_args}
56 done
60 pccard_ether_start()
62 ifexists $ifn || exit 1
64 if [ -z "$rc_force" ]; then
65 for uif in `ifconfig -ul`; do
66 if [ "${uif}" = "${ifn}" ]; then
67 # Interface is already up, so ignore it.
68 exit 0
70 done
73 /etc/rc.d/netif start $ifn
75 # Do route configuration if needed.
76 # XXX: should probably do this by calling rc.d/routing.
77 if [ -n "`ifconfig_getargs $ifn`" ]; then
78 if ! dhcpif $ifn; then
79 setup_routes
83 # XXX: IPv6 setup should be done in some way.
86 pccard_ether_stop()
88 if [ -n "`ifconfig_getargs $ifn`" ]; then
89 if ! dhcpif $ifn; then
90 remove_routes
94 /etc/rc.d/netif stop $ifn
96 # clean ARP table
97 ifexists $ifn && arp -d -i $ifn -a
100 pccard_ether_restart()
102 # Hand implemented because the default implementation runs
103 # the equivalent of "$0 start; $0 stop" and this script
104 # doesn't support that syntax
105 pccard_ether_stop
106 pccard_ether_start
109 pccard_ether_startchildren()
111 for child in `get_if_var $ifn wlans_IF`; do
112 if ifexists $child; then
113 continue
115 /etc/rc.d/netif start $child
116 done
119 pccard_ether_stopchildren()
121 for child in `get_if_var $ifn wlans_IF`; do
122 /etc/rc.d/netif stop $child
123 done
126 ifn=$1
127 shift
128 if [ -z "$*" ]; then
129 args="start"
130 else
131 args=$*
134 load_rc_config pccard_ether
135 load_rc_config network
136 run_rc_command $args