Module Name: src
Committed By: roy
Date: Tue Jun 25 13:02:53 UTC 2013
Modified Files:
src/etc/rc.d: dhcpcd
Log Message:
Add a hack to fix the dhcpcd rc.d script to work with a single
interface specified in dhcpcd_flags in rc.conf(5).
Fixes PR bin/43490
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/rc.d/dhcpcd
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.1 src/etc/rc.d/dhcpcd:1.2
--- src/etc/rc.d/dhcpcd:1.1 Tue Apr 28 23:30:34 2009
+++ src/etc/rc.d/dhcpcd Tue Jun 25 13:02:53 2013
@@ -9,7 +9,27 @@ $_rc_subr_loaded . /etc/rc.subr
name=dhcpcd
rcvar=$name
command=/sbin/$name
-pidfile=/var/run/$name.pid
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"