| @@ -14,23 +14,27 @@ extra_commands="reload" | | | @@ -14,23 +14,27 @@ extra_commands="reload" |
14 | load_rc_config $name | | 14 | load_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. |
19 | if [ -n "$flags" ]; then | | 19 | if [ -n "$flags" ]; then |
20 | myflags=$flags | | 20 | myflags=$flags |
21 | else | | 21 | else |
22 | eval myflags=\$${name}_flags | | 22 | eval myflags=\$${name}_flags |
23 | fi | | 23 | fi |
24 | ifname="${myflags##* }" | | 24 | ifname="${myflags##* }" |
25 | myflags="${myflags%% $ifname}" | | 25 | myflags="${myflags%% $ifname}" |
26 | last_flag="${myflags##* }" | | 26 | last_flag="${myflags##* }" |
| | | 27 | # Address the problem of having just dhcpcd_flags=wm0 |
| | | 28 | if [ "$myflags" = "$last_flag" ]; then |
| | | 29 | last_flag="invalidinterfacename" |
| | | 30 | fi |
27 | if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && | | 31 | if /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 |
29 | then | | 33 | then |
30 | pidfile=/var/run/$name-"$ifname".pid | | 34 | pidfile=/var/run/$name-"$ifname".pid |
31 | else | | 35 | else |
32 | pidfile=/var/run/$name.pid | | 36 | pidfile=/var/run/$name.pid |
33 | fi | | 37 | fi |
34 | unset myflags ifname last_flag | | 38 | unset myflags ifname last_flag |
35 | | | 39 | |
36 | run_rc_command "$1" | | 40 | run_rc_command "$1" |