phunix/etc/rc.d/dhcpcd
David van Moolenbroek 9f20bfa6c4 Import NetBSD dhcpcd(8)
The port could be improved by adding support for pselect(2).

Other than that, this port has a few MINIX-specific changes:

- we undefine IN_IFF_ flags to stop dhcpcd from thinking that we have
  operating system support for link-local IPv4 address management;
- we work around one crash bug that seems triggered by using dhcpcd
  on some but not all interfaces;
- we add "noalias" to the default dhcpcd.conf(5) configuration file.

Change-Id: I8a81c2c2af353c5ce08335673b1ab2d4b39178da
2017-03-21 21:59:13 +00:00

37 lines
801 B
Bash
Executable File

#!/bin/sh
# PROVIDE: dhcpcd
# REQUIRE: network mountcritlocal
# BEFORE: NETWORKING
$_rc_subr_loaded . /etc/rc.subr
name=dhcpcd
rcvar=$name
command=/sbin/$name
extra_commands="reload"
load_rc_config $name
# If the last argument to dhcpcd is a valid interface and the prior argument
# is not then dhcpcd will start on one interface only and create a pidfile
# based on the interface name. See PR bin/43490.
if [ -n "$flags" ]; then
myflags=$flags
else
eval myflags=\$${name}_flags
fi
ifname="${myflags##* }"
myflags="${myflags%% $ifname}"
last_flag="${myflags##* }"
if /sbin/ifconfig "$ifname" >/dev/null 2>&1 &&
! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
then
pidfile=/var/run/$name-"$ifname".pid
else
pidfile=/var/run/$name.pid
fi
unset myflags ifname last_flag
run_rc_command "$1"