summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/dhclient
blob: d296825da619dbc86f76ce934183c6cf7c9a0b31 (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
#!/bin/sh
#
# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#

# PROVIDE: dhclient
# REQUIRE: network netif mountcritlocal
# BEFORE:  NETWORKING
# KEYWORD: FreeBSD NetBSD
#
#	Note that there no syslog logging of dhclient messages at boot because
#	dhclient needs to start before services that syslog depends upon do.
#

. /etc/rc.subr
. /etc/network.subr

name="dhclient"
command="/sbin/${name}"
pidfile="/var/run/${name}.pid"
case "${OSTYPE}" in
FreeBSD)
	rcvar=
	start_precmd="dhclient_prestart"
	start_postcmd="dhclient_poststart"
	;;
NetBSD)
	rcvar=$name
	;;
esac

dhclient_prestart()
{
	dhcp_list="`list_net_interfaces dhcp`"
	if [ -z "$dhcp_list" ]; then
		return 1
	fi

	for ifn in ${dhcp_list}; do
		ifscript_up ${ifn}
	done

	rc_flags="${rc_flags} ${dhcp_flags} ${dhcp_list}"
	return 0
}

dhclient_poststart()
{
	for ifn in ${dhcp_list}; do
		ifalias_up ${ifn}
		ipx_up ${ifn}
		ifconfig ${ifn}
	done
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud