Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 881039 - net-misc/netifrc-0.7.3: dhcpcd not passing args in stop function
Summary: net-misc/netifrc-0.7.3: dhcpcd not passing args in stop function
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: netifrc (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: netifrc Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-12 00:50 UTC by kevinmbecause
Modified: 2023-10-20 00:51 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to add args to dhcpcd upon stop (netifrc_stop_fix.patch,548 bytes, patch)
2022-11-12 00:52 UTC, kevinmbecause
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kevinmbecause 2022-11-12 00:50:51 UTC
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
Comment 1 kevinmbecause 2022-11-12 00:52:17 UTC
Created attachment 831683 [details, diff]
Patch to add args to dhcpcd upon stop
Comment 2 Larry the Git Cow gentoo-dev 2022-12-25 19:07:36 UTC
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(-)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-17 04:42:25 UTC
Fixed in 0.7.4.
Comment 4 Guido Jäkel 2023-10-19 21:43:44 UTC
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}" ;;
Comment 5 Larry the Git Cow gentoo-dev 2023-10-19 22:57:25 UTC
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(-)
Comment 6 Larry the Git Cow gentoo-dev 2023-10-20 00:51:34 UTC
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(+)