On Fri, Feb 25, 2022 at 3:52 PM Roy Marples <r...@marples.name> wrote:
>
> On 25/02/2022 09:25, Martin-Éric Racine wrote:
> > Right now, my personal experiements with dhcpcd indicate that
> > something as simple as passing options to wpa_supplicant via dhcpcd's
> > configuration file is not an easy task.
>
> Why would you want to? They have separate domains of responsibility. One
> configures the addressing and routes and other misc related stuff and the 
> other
> brings up the actual link to do this on.

Because having the configuration data for all interfaces is
/etc/network/interfaces' whole point.

> dhcpcd's wpa_supplicant hook was written to solely support hotplugging a USB
> wireless stick into a machine without any kind of hotplug support.
> Since then I have added then -M flag to wpa_supplicant so it can do it by 
> itself.

Which is a problem. dhcpcd and systemd currently compete for control
of the wireless device. systemd tries to rename it to follow
Predictable Network Interface Names at the same time as dhcpcd tries
to to connect it to a network. It results in configuration failing.
Also, unless I missed something, dhcpcd doesn't currently have the
built-in logic to understand whether a device is wireless (needs WPA)
or not (doesn't need anythign else than DHCP).

> Now if you want to configure wpa_supplicant via dhcpcd for a specific wireless
> network then the dhcpcd-ui project exists for that and relies on the
> wpa_supplicant config being writable via the wpa_supplicant control socket.

Nice idea for laptops, not so good idea for hosts that need to
repeatedly connect to the same AP and then perform otherws tasks such
as serve as a bridge for a LAN. For instance:

allow-hotplug enp9s0 wlp12s0
iface enp9s0 inet dhcp
iface enp9s0 inet6 auto
    privext 2
    dhcp 1
iface wlp12s0 inet dhcp
    wpa-ssid <SSID>
    wpa-psk <password>
iface wlp12s0 inet6 auto
    privext 2
    dhcp 1

This results in the host always getting a connection. If just routes
through whichever interface managed to get a DHCP configuration.

> > Ditto for enabling prefix
> > delegation to a second interface.
>
> Lets talk about this separately.
> Please email me and I'll help you with your setup, no need to muddy an 
> unrelated
> debian bug report about it.

The point here was how not doing it in a flat file where all
interfaces can be centrally configured is a distraction. The one file
provides a centralized view and a uniform syntax.

> > Via ifupdown's
> > /etc/network/interfaces these follow a normalized syntax that is
> > completely independant of which tools perform the actual network
> > configuration under the hood.
>
> ifupdown is great for static configuration.
> I would use it to configure links such as bonding, bridging, etc.
> Anything dynamic, not so great.
>
> For example having ifupdown start separate instances of a DHCP client per
> interface is not only a waste of resources it also introduces undefined
> behaviour because only one of these can bind to the unspecified address. The
> only way around this is opening a socket for every address on the interface.
> If you have a lot of interfaces or addresses dhcpcd would rapidly drain
> available resources just to guarantee a defined behaviour.

The separate stanzas for inet and inet6 is something I've long
wondered about. dhclient's man page has the answer:

4     Use the DHCPv4 protocol to obtain an IPv4 address and
configuration parameters.  This is the default and cannot be combined
with -6.

This is precisely why I want to replace dhclient with dhcpcd as the
default DHCP client.  If an interface is marked in
/etc/network/interfaces as DHCP type, both IPv4 and IPv6 should be
attempted in a transparent way, and dhcpcd does that wonderfully.

> >>> Configure's upstream default paths make Lintian bark, so I've kept the 
> >>> overrides in debian/rules for now. It might be worth working with 
> >>> upstream on making the defaults do what FHS and current packaging 
> >>> practices want.
> >>
> >> The default upstream paths mirror that of a BSD system. I belive that is in
> >> conflict with FHS.
> >
> > There's more. For instance, manual pages canonically go to
> > /usr/share/man/manX (or /usr/local/share/man/manX for locally-built
> > packages). dhcpcd's Configure defaults put these in /share/man/manX if
> > no prefix is passed to configure. Also hooks are currectly put in
> > ${prefix}/libexec (which is the correct FHS location), but since they
> > are not executable and lack the Bourne shell shebang, Lintian barks.
>
> dhcpcd's configure default puts them into /usr/share/man/manX if nothing is
> passed to configure. Maybe the Debian package is doing something differently?
>
> The hooks that dhcpcd-run-hooks calls make zero sense being executed outside 
> of
> dhcpcd-run-hooks so being marked executable with a shell shebang also makes 
> zero
> sense.

Here's what I get on a build that uses the upstream configure defaults
as-is (i.e.overrides in debian/rules disabled):

SYSCONFDIR =        /etc
SBINDIR =        /usr/sbin
LIBDIR =        /lib/i386-linux-gnu
LIBEXECDIR =        /usr/libexec
DBDIR =        /var/db/dhcpcd
RUNDIR =        /run/dhcpcd
MANDIR =        /share/man
DATADIR =        /usr/share
HOOKSCRIPTS =
EGHOOKSCRIPTS =    50-yp.conf
STATUSARG =
PRIVSEPUSER =    dhcpcd

E: dhcpcd5: non-standard-dir-in-var var/db/
E: dhcpcd5: non-standard-toplevel-dir share/
W: dhcpcd5-dbgsym: elf-error In program headers: Unable to find
program interpreter name
[usr/lib/debug/.build-id/df/5e855a885adce7a0063b55ff5f1e406f77cd48.debug]
W: dhcpcd5: executable-not-elf-or-script usr/libexec/dhcpcd-hooks/01-test
W: dhcpcd5: executable-not-elf-or-script usr/libexec/dhcpcd-hooks/20-resolv.conf
W: dhcpcd5: executable-not-elf-or-script usr/libexec/dhcpcd-hooks/30-hostname
W: dhcpcd5: file-in-unusual-dir share/man/man5/dhcpcd.conf.5
W: dhcpcd5: file-in-unusual-dir share/man/man8/dhcpcd-run-hooks.8
W: dhcpcd5: file-in-unusual-dir share/man/man8/dhcpcd.8
W: dhcpcd5: no-manual-page usr/sbin/dhcpcd

drwxr-xr-x root/root         0 2022-02-24 15:08 ./etc/
-rw-r--r-- root/root      1429 2022-02-24 15:08 ./etc/dhcpcd.conf
drwxr-xr-x root/root         0 2022-02-24 15:08 ./etc/init.d/
-rwxr-xr-x root/root      1905 2019-05-03 16:14 ./etc/init.d/dhcpcd
drwxr-xr-x root/root         0 2022-02-24 15:08 ./lib/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./lib/systemd/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./lib/systemd/system/
-rw-r--r-- root/root       191 2019-05-03 16:14
./lib/systemd/system/dhcpcd.service
drwxr-xr-x root/root         0 2022-02-24 15:08 ./share/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./share/man/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./share/man/man5/
-rw-r--r-- root/root     30106 2022-02-24 15:08 ./share/man/man5/dhcpcd.conf.5
drwxr-xr-x root/root         0 2022-02-24 15:08 ./share/man/man8/
-rw-r--r-- root/root      7091 2022-02-24 15:08
./share/man/man8/dhcpcd-run-hooks.8
-rw-r--r-- root/root     26559 2022-02-24 15:08 ./share/man/man8/dhcpcd.8
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/lib/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/lib/dhcpcd/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/lib/dhcpcd/dhcpcd-hooks/
-rw-r--r-- root/root      2496 2019-05-03 16:14
./usr/lib/dhcpcd/dhcpcd-hooks/60-ntp-common.conf
-rw-r--r-- root/root       380 2019-05-03 16:14
./usr/lib/dhcpcd/dhcpcd-hooks/62-chrony.conf
-rw-r--r-- root/root       466 2019-05-03 16:14
./usr/lib/dhcpcd/dhcpcd-hooks/64-timesyncd.conf
-rw-r--r-- root/root       546 2019-05-03 16:14
./usr/lib/dhcpcd/dhcpcd-hooks/66-ntp.conf
-rw-r--r-- root/root       549 2019-05-03 16:14
./usr/lib/dhcpcd/dhcpcd-hooks/68-openntpd.conf
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/libexec/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/libexec/dhcpcd-hooks/
-rwxr-xr-x root/root       734 2022-02-24 15:08
./usr/libexec/dhcpcd-hooks/01-test
-rwxr-xr-x root/root      6164 2022-02-24 15:08
./usr/libexec/dhcpcd-hooks/20-resolv.conf
-rwxr-xr-x root/root      3762 2022-02-24 15:08
./usr/libexec/dhcpcd-hooks/30-hostname
-rwxr-xr-x root/root      8163 2022-02-24 15:08 ./usr/libexec/dhcpcd-run-hooks
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/sbin/
-rwxr-xr-x root/root    404904 2022-02-24 15:08 ./usr/sbin/dhcpcd
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/share/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/share/dhcpcd/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/share/dhcpcd/hooks/
-rw-r--r-- root/root      2832 2022-02-24 15:08
./usr/share/dhcpcd/hooks/10-wpa_supplicant
-rw-r--r-- root/root       885 2022-02-24 15:08
./usr/share/dhcpcd/hooks/15-timezone
-rw-r--r-- root/root       814 2022-02-24 15:08
./usr/share/dhcpcd/hooks/29-lookup-hostname
-rw-r--r-- root/root      1163 2022-02-24 15:08
./usr/share/dhcpcd/hooks/50-yp.conf
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/share/doc/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./usr/share/doc/dhcpcd5/
-rw-r--r-- root/root      2619 2022-02-24 15:08
./usr/share/doc/dhcpcd5/changelog.Debian.gz
-rw-r--r-- root/root      7966 2022-02-24 09:34
./usr/share/doc/dhcpcd5/copyright
drwxr-xr-x root/root         0 2022-02-24 15:08 ./var/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./var/db/
drwxr-xr-x root/root         0 2022-02-24 15:08 ./var/db/dhcpcd/

Martin-Éric

Reply via email to