Fri Oct 16 18:06:22 2015 UTC ()
Fix the problem of just having a valid interface name in dhcpcd_flags.


(roy)
diff -r1.3 -r1.4 src/etc/rc.d/dhcpcd

cvs diff -r1.3 -r1.4 src/etc/rc.d/dhcpcd (expand / switch to unified diff)

--- src/etc/rc.d/dhcpcd 2014/04/06 17:13:57 1.3
+++ src/etc/rc.d/dhcpcd 2015/10/16 18:06:22 1.4
@@ -14,23 +14,27 @@ extra_commands="reload" @@ -14,23 +14,27 @@ extra_commands="reload"
14load_rc_config $name 14load_rc_config $name
15 15
16# If the last argument to dhcpcd is a valid interface and the prior argument 16# If the last argument to dhcpcd is a valid interface and the prior argument
17# is not then dhcpcd will start on one interface only and create a pidfile 17# is not then dhcpcd will start on one interface only and create a pidfile
18# based on the interface name. See PR bin/43490. 18# based on the interface name. See PR bin/43490.
19if [ -n "$flags" ]; then 19if [ -n "$flags" ]; then
20 myflags=$flags 20 myflags=$flags
21else 21else
22 eval myflags=\$${name}_flags 22 eval myflags=\$${name}_flags
23fi 23fi
24ifname="${myflags##* }" 24ifname="${myflags##* }"
25myflags="${myflags%% $ifname}" 25myflags="${myflags%% $ifname}"
26last_flag="${myflags##* }" 26last_flag="${myflags##* }"
 27# Address the problem of having just dhcpcd_flags=wm0
 28if [ "$myflags" = "$last_flag" ]; then
 29 last_flag="invalidinterfacename"
 30fi
27if /sbin/ifconfig "$ifname" >/dev/null 2>&1 &&  31if /sbin/ifconfig "$ifname" >/dev/null 2>&1 &&
28 ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1 32 ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
29then 33then
30 pidfile=/var/run/$name-"$ifname".pid 34 pidfile=/var/run/$name-"$ifname".pid
31else 35else
32 pidfile=/var/run/$name.pid 36 pidfile=/var/run/$name.pid
33fi 37fi
34unset myflags ifname last_flag 38unset myflags ifname last_flag
35 39
36run_rc_command "$1" 40run_rc_command "$1"