dhcpcd-discuss

Re: Evolution request for managing namespaces

Stéphane Veyret

Wed Apr 08 09:04:48 2020

Hi Roy,

Le mar. 7 avr. 2020 à 16:57, Roy Marples <roy@xxxxxxxxxxxx> a écrit :
> > Do you think a “--nomaster” option (which would simply ignore the
> > socket) would be complicated to implement?
>
> Actually yes it is complicated :)
> What if you run --nomaster and there are two interfaces?

I'd say that you should do what is the simplest: either exit with
error, or start provided interfaces independently.

> You can achieve this on linux as it stands with a simple shell script, pasted below.
>
> Let me know how it works for you!

Yes, it works with this script, thanks a lot. But it will require me
to modify my OpenRC script (I am using Gentoo) which could be
overridden at next update.
If I look at the copyright of the OpenRC script, it seems that it is
provided by you, but I couldn't find it in the dhcpcd git tree.
If you don't want to add the “--nomaster” option, would that be
possible to at least modify the script so that it can be provided
options? I was thinking of something like that:

======
--- a/init.d/dhcpcd  2020-04-08 09:27:27.126857093 +0200
+++ b/init.d/dhcpcd      2020-04-08 08:35:46.713513880 +0200
@@ -3,8 +3,8 @@
 # All rights reserved. Released under the 2-clause BSD license.

 command=/sbin/dhcpcd
-pidfile=/var/run/dhcpcd.pid
-command_args=-q
+[[ -z ${DHCPCD_IFACE} ]] && pidfile=/var/run/dhcpcd.pid ||
pidfile=/var/run/dhcpcd-${DHCPCD_IFACE}.pid
+command_args="${DHCPCD_OPTIONS:--q} ${DHCPCD_IFACE}"
 name="DHCP Client Daemon"

 depend()
======

You could also provide a sample configuration file conf.d/dhcpcd:

======
# You may specify options to provide to the dhcpcd service.
# By default, service will start in master mode with quiet option.
#DHCPCD_OPTIONS=-q

# If the dhcpcd service should start for a single interface (no master mode),
# specify the interface name here.
#DHCPCD_IFACE=eth0
======

I can provide a PR or a git diff if you prefer.

Follow-Ups:
Re: Evolution request for managing namespacesRoy Marples
References:
Evolution request for managing namespacesStéphane Veyret
Re: Evolution request for managing namespacesRoy Marples
Re: Evolution request for managing namespacesStéphane Veyret
Re: Evolution request for managing namespacesRoy Marples
Archive administrator: postmaster@marples.name