blob: 80f4a2287384acdd02e5198af7d9a295d9511f87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#!/bin/sh -
#
# $FreeBSD$
#
# pccard_ether interfacename [start|stop] [ifconfig option]
#
# example: pccard_ether ep0 start -link0
#
stop_dhcp() {
if [ -r /sbin/dhclient ]; then
pidfile="/var/run/dhclient.${interface}.pid"
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}`
rm ${pidfile}
fi
elif [ -r /usr/local/sbin/dhcpc ]; then
pidfile="/var/run/dhcpc.${interface}.pid"
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}`
rm ${pidfile}
fi
fi
}
start_dhcp() {
stop_dhcp
if [ -r /sbin/dhclient ]; then
pidfile="/var/run/dhclient.${interface}.pid"
/sbin/dhclient -pf ${pidfile} $interface
elif [ -r /usr/local/sbin/dhcpc ]; then
/usr/local/sbin/dhcpc $interface
else
echo "DHCP client software not available (isc-dhcp2)"
fi
}
# Suck in the configuration variables
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
interface=$1
shift
startstop=$2
shift
case ${startstop} in
[Ss][Tt][Aa][Rr][Tt] | '')
case ${pccard_ifconfig} in
[Nn][Oo] | '')
;;
[Dd][Hh][Cc][Pp])
start_dhcp
;;
*)
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
# IPv6 setup
case ${ipv6_enable} in
[Yy][Ee][Ss])
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
;;
*)
sysctl -w net.inet6.ip6.forwarding=0
sysctl -w net.inet6.ip6.accept_rtadv=1
ifconfig ${interface} up
rtsol ${interface}
;;
esac
;;
esac
;;
# Stop the interface
*)
/sbin/ifconfig $device delete
stop_dhcp
;;
esac
|