The dhcpcd module goes through all the trouble of saving the arguments to a file in dhcpcd_start() and retrieving them in dhcpcd_stop(), but it never actually passes the arguments to dhcpcd. This can cause the stop function to miss the running dhcpcd instance and never stop it if certain arguments are specified by the user. Reproducible: Always Steps to Reproduce: 1. Set dhcpcd_wan0="-4" in /etc/conf.d/net 2. Start net.wan0 3. Stop net.wan0 Actual Results: "dhcpcd not running" in the output and dhcpcd process is still running after stopping the interface Expected Results: "sending signal TERM to pid 3376" and "waiting for pid 3376 to exit" in the output and the dhcpcd process is no longer running after the interface is stopped
Created attachment 831683 [details, diff] Patch to add args to dhcpcd upon stop
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=bd8ff4aa89e1d56e9886dad32bb2406c8f43c747 commit bd8ff4aa89e1d56e9886dad32bb2406c8f43c747 Author: kmartin36 <Kevin.Martin@gtri.gatech.edu> AuthorDate: 2022-12-17 08:26:21 +0000 Commit: Robin H. Johnson <robbat2@gentoo.org> CommitDate: 2022-12-25 19:06:36 +0000 Adding the saved args to the stop command Closes: https://bugs.gentoo.org/881039 Signed-off-by: Kevin Martin <kevinmbecause@gmail.com> (cherry picked from commit 0e1c19959a6d82accdb57fa7a1f5b0036037a001) Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Closes: https://github.com/gentoo/netifrc/pull/41 net/dhcpcd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Fixed in 0.7.4.
In my setup, I'm using the options set dhcpcd_eth0="-K -E -p -t 40 -y 5 --noipv4ll -e hostname_fqdn=false" Since this patch, the shutdown of the dhcpcd during the stop of the interface throw the error dhcpcd: invalid option -- ' ' and the dhcpcd continue to run. Using the debug option (-d) of OpenRC will show the call causing the issue as [...] + dhcpcd -x '-K -E -p -t 40 -y 5 --noipv4ll -e hostname_fqdn=false' eth0 [...] I think that the term "${args}" will pass the whole options string as a single argument to the dhcpcd and it's parser will fail on this. Removing the surrounding quotes - *) dhcpcd -x "${args}" "${IFACE}" ;; + *) dhcpcd -x ${args} "${IFACE}" ;; resolves the issue for me. If qouting of the options is need for real, one may use + *) dhcpcd -x $(printf '"%s" ' $args) "${IFACE}" ;;
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=bf02831a7a59f5552c916dde7dd47296a7bce0b1 commit bf02831a7a59f5552c916dde7dd47296a7bce0b1 Author: kmartin36 <Kevin.Martin@gtri.gatech.edu> AuthorDate: 2023-09-15 01:29:27 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-10-19 22:57:19 +0000 dhcpcd: Fixing the handling of dhcpcd arguments with spaces Bug: https://bugs.gentoo.org/881039 Signed-off-by: Kevin Martin <kevinmbecause@gmail.com> Fixes: bd8ff4aa89e1d56e9886dad32bb2406c8f43c747 Closes: https://github.com/gentoo/netifrc/pull/48 Signed-off-by: Sam James <sam@gentoo.org> net/dhcpcd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3068dae27987ad0a46602001efc433f03459e35 commit b3068dae27987ad0a46602001efc433f03459e35 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-10-20 00:21:57 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-10-20 00:50:59 +0000 net-misc/netifrc: add 0.7.7 Bug: https://bugs.gentoo.org/881039 Signed-off-by: Sam James <sam@gentoo.org> net-misc/netifrc/Manifest | 1 + net-misc/netifrc/netifrc-0.7.7.ebuild | 91 +++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+)