#982959 ifupdown: pattern matching not working for allow-hotplug

Package:
ifupdown
Source:
ifupdown
Description:
high level tools to configure network interfaces
Submitter:
Martin-Éric Racine
Date:
2021-10-08 08:54:02 UTC
Severity:
normal
Tags:
#982959#5
Date:
2021-02-17 12:32:24 UTC
From:
To:
The regex recipe below does not work as expected. I've tried both

allow-hotplug /en*=en /wl*=wl

and

allow-hotplug /en*/=en /wl*/=wl

but ifup still doesn't raise whatever interface match the regex. Have I misunderstood the examples or am I missing something else?

Thanks!

- -- Package-specific info:
- --- /etc/network/interfaces:
allow-hotplug /en*=en /wl*=wl

iface en inet dhcp
iface en inet6 auto
        privext 2
        #dhcp 1

iface wl inet dhcp
        wpa-ssid AccessPoint
        wpa-psk mypassword
iface wl inet6 auto
        privext 2
        #dhcp 1

- --- up and down scripts installed:
/etc/network/if-down.d:
total 0
lrwxrwxrwx 1 root root 32 Feb  6 19:04 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-post-down.d:
total 4
- -rwxr-xr-x 1 root root 1409 Mar 24  2016 wireless-tools
lrwxrwxrwx 1 root root   32 Feb  6 19:04 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-pre-up.d:
total 12
- -rwxr-xr-x 1 root root  344 Apr 28  2012 ethtool
- -rwxr-xr-x 1 root root 4191 Sep 15  2018 wireless-tools
lrwxrwxrwx 1 root root   32 Feb  6 19:04 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-up.d:
total 12
- -rwxr-xr-x 1 root root 1685 Sep 22  2014 ethtool
- -rwxr-xr-x 1 root root 4938 Aug 14  2020 mountnfs
lrwxrwxrwx 1 root root   32 Feb  6 19:04 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh


- -- System Information:
Debian Release: bullseye/sid
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (500, 'stable')
Architecture: i386 (i586)

Kernel: Linux 5.10.0-3-686 (SMP w/1 CPU thread)
Kernel taint flags: TAINT_CPU_OUT_OF_SPEC
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8), LANGUAGE=fi:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ifupdown depends on:
ii  adduser   3.118
ii  iproute2  5.10.0-4
ii  libc6     2.31-9
ii  lsb-base  11.1.0

Versions of packages ifupdown recommends:
ii  isc-dhcp-client [dhcp-client]  4.4.1-2.2

Versions of packages ifupdown suggests:
ii  ppp     2.4.9-1+1
pn  rdnssd  <none>

- -- debconf information:
  ifupdown/convert-interfaces-hotplug: true
  ifupdown/convert-interfaces: true
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEyJACx3qL7GpObXOQrh+Cd8S017YFAmAtDNEACgkQrh+Cd8S0
17YaRg/+K73vsgfY3Mv7m2xMyhTh0uE3eugrhvu3Wg8LxUWfzj1dG/Pd3Rx5baTh
7Pa5O4Da0Az8i5jz5bL7JH+yOtxVlXdX1TBYAN6XNsCVetYrq7/XR3WC8Qt3jN9S
oF6pm3ltU9FUnvdL4tM1WGd850qTH1PAUSb5Yj61HZOm6NJkFZ42s2tqTEiPRNkg
6lumGEXaPPksCFGM0oME2ay97eYAkNkjWj/5bwAmIzCGioaNgjhGQN7aei6nNpTG
bMlNaHMWGfl9tSO0WS0GbDdGBZTxm+o9lPG23Dhxtcz58cQIqqUb3FAWuvw1flYF
nJBuUvyqalwt8JktMmse6SFv+g9vCm38n9ge4pJSg3Zy1ZFqe4CdW2JRFqTknIdY
bt2o7aEQ+j1ArivBD1nDvdBfRSx3QsWRlWjlFNnQhFJgqWFqbA85oD3N7BO5eKrA
aDnKfI3HWg5uJZVHU3d/rm4dYb3WT7HaiprhHdJvVgyVEXGxMNjdMfFrEarnVDmW
d/R6cZV4FqZpkFippaWhgRgDPoH5JyOv5FMiuF0FOfUKssHv+9pAjuYkF5CFqlKM
tHaXLJ33Hyd/gb/NUvhyBBoTraXQ/ZIITNjIRCeKEcXoan1Aw54I/R5mTUnVKT9r
EqDhuIQIlF2fExsC4RPXEpj/wJlR6g1vFD0Hpc1IS8t7Hk0de5s=
=nDlC
-----END PGP SIGNATURE-----

#982959#12
Date:
2021-10-01 13:16:21 UTC
From:
To:
Hello there,

Sorry for the late answer.

Just to avoid confusion, I prefer to retitle the bug: patterns are more
accurate than regex here.

with this /e/n/interfaces inside an lxc container (so no udev) with two
interfaces (eth0 and eth1):

	auto lo
	iface lo inet loopback

	allow-hotplug /eth*=lan

	iface lan inet dhcp

patterns seem to match:

	 ifdown /eth*

Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   Socket/fallback
DHCPRELEASE of 10.0.3.48 on eth0 to 10.0.3.1 port 67
Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/72:73:72:06:14:7c
Sending on   LPF/eth1/72:73:72:06:14:7c
Sending on   Socket/fallback
DHCPRELEASE of 10.0.3.222 on eth1 to 10.0.3.1 port 67


	ifup --allow hotplug -a -v
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge

ifup: configuring interface eth0=lan (inet)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge

CLIENT="-i";  /sbin/dhclient -4 -v $CLIENT -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPOFFER of 10.0.3.48 from 10.0.3.1
DHCPREQUEST for 10.0.3.48 on eth0 to 255.255.255.255 port 67
DHCPACK of 10.0.3.48 from 10.0.3.1
bound to 10.0.3.48 -- renewal in 1672 seconds.
run-parts --exit-on-error --verbose /etc/network/if-up.d

ifup: configuring interface eth1=lan (inet)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge

CLIENT="-i";  /sbin/dhclient -4 -v $CLIENT -pf /run/dhclient.eth1.pid -lf /var/lib/dhcp/dhclient.eth1.leases -I -df /var/lib/dhcp/dhclient6.eth1.leases eth1
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/72:73:72:06:14:7c
Sending on   LPF/eth1/72:73:72:06:14:7c
Sending on   Socket/fallback
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 5
DHCPOFFER of 10.0.3.222 from 10.0.3.1
DHCPREQUEST for 10.0.3.222 on eth1 to 255.255.255.255 port 67


I get both interfaces configured. Could you please run ifup with -v?

Cheers,

#982959#17
Date:
2021-10-01 13:16:21 UTC
From:
To:
Hello there,

Sorry for the late answer.

Just to avoid confusion, I prefer to retitle the bug: patterns are more
accurate than regex here.

with this /e/n/interfaces inside an lxc container (so no udev) with two
interfaces (eth0 and eth1):

	auto lo
	iface lo inet loopback

	allow-hotplug /eth*=lan

	iface lan inet dhcp

patterns seem to match:

	 ifdown /eth*

Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   Socket/fallback
DHCPRELEASE of 10.0.3.48 on eth0 to 10.0.3.1 port 67
Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/72:73:72:06:14:7c
Sending on   LPF/eth1/72:73:72:06:14:7c
Sending on   Socket/fallback
DHCPRELEASE of 10.0.3.222 on eth1 to 10.0.3.1 port 67


	ifup --allow hotplug -a -v
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge

ifup: configuring interface eth0=lan (inet)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge

CLIENT="-i";  /sbin/dhclient -4 -v $CLIENT -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   LPF/eth0/d6:ca:92:4e:8b:ef
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPOFFER of 10.0.3.48 from 10.0.3.1
DHCPREQUEST for 10.0.3.48 on eth0 to 255.255.255.255 port 67
DHCPACK of 10.0.3.48 from 10.0.3.1
bound to 10.0.3.48 -- renewal in 1672 seconds.
run-parts --exit-on-error --verbose /etc/network/if-up.d

ifup: configuring interface eth1=lan (inet)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge

CLIENT="-i";  /sbin/dhclient -4 -v $CLIENT -pf /run/dhclient.eth1.pid -lf /var/lib/dhcp/dhclient.eth1.leases -I -df /var/lib/dhcp/dhclient6.eth1.leases eth1
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/72:73:72:06:14:7c
Sending on   LPF/eth1/72:73:72:06:14:7c
Sending on   Socket/fallback
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 5
DHCPOFFER of 10.0.3.222 from 10.0.3.1
DHCPREQUEST for 10.0.3.222 on eth1 to 255.255.255.255 port 67


I get both interfaces configured. Could you please run ifup with -v?

Cheers,

#982959#22
Date:
2021-10-01 14:05:28 UTC
From:
To:
pe 1. lokak. 2021 klo 16.21 Santiago Ruano Rincón
(santiagorr@riseup.net) kirjoitti:

[...]

I just tried. Here's an interesting difference:

If I use 'sudo ifup -a -v' ifup won't find the mapped interfaces.

If I use 'sudo ifup --allow hotplug -a -v' ifup correctly finds and
maps the wireless interfaces.

Martin-Éric

#982959#27
Date:
2021-10-01 20:26:09 UTC
From:
To:
Thanks!
#982959#34
Date:
2021-10-01 20:39:27 UTC
From:
To:
El 01/10/21 a las 17:05, Martin-Éric Racine escribió:

ifup doesn't process them since they are not configured with `auto`

s/allow-hotplug/auto/ in my /e/n/interfaces makes this work.

I wonder if there is a problem related with udev instead.

Cheers,

#982959#39
Date:
2021-10-02 07:05:22 UTC
From:
To:
pe 1. lokak. 2021 klo 23.39 Santiago Ruano Rincón
(santiagorr@riseup.net) kirjoitti:

OK, what processes interfaces with allow-hotplug then, if not ifupdown?

Added udev (systemd) maintainers in CC.

Martin-Éric

#982959#44
Date:
2021-10-02 08:13:14 UTC
From:
To:
Am 02.10.21 um 09:05 schrieb Martin-Éric Racine:

If you are referring to
/lib/udev/ifupdown-hotplug and /lib/udev/rules.d/80-ifupdown.rules,
those files are maintained by the ifupdown package.

The systemd package is not involved here.

#982959#51
Date:
2021-10-06 06:24:29 UTC
From:
To:
la 2. lokak. 2021 klo 11.13 Michael Biebl (biebl@debian.org) kirjoitti:

Michael, I suspected as much. Thanks for confirming this.

Santiago, all evidences point to ifupdown pattern matching only
working for auto interfaces, but not hotplug interfaces. Basically,
hotplug works for named interfaces, but not for pattern matched
interfaces.

Martin-Éric

#982959#56
Date:
2021-10-06 09:20:16 UTC
From:
To:
El 06/10/21 a las 09:24, Martin-Éric Racine escribió:

Not exactly, I think. 'sudo ifup --allow hotplug -a -v' works for you.

ifupdown-hotplug receives as argument the name of the real
interface, so it execs ifup --allow=hotplug $INTERFACE
https://salsa.debian.org/debian/ifupdown/-/blob/master/debian/ifupdown-hotplug#L73
and it wouldn't find it in your configuration.

Maybe your use case matches better templates and inherits (See INTERFACE
TEMPLATES) in interfaces(5).

HTH,

#982959#61
Date:
2021-10-06 09:28:10 UTC
From:
To:
ke 6. lokak. 2021 klo 12.20 Santiago Ruano Rincón
(santiagorr@riseup.net) kirjoitti:

I should not have to type that manually to have ifupdown find and
raise the interfaces.

Which is precisely the problem. The mapping fails.

It doesn't. Templates rely upon explicitly defining interfaces.

Martin-Éric

#982959#66
Date:
2021-10-06 12:19:41 UTC
From:
To:
El 06/10/21 a las 12:28, Martin-Éric Racine escribió:

OK, I see.

So the problem is not explicitly related to ifupdown. With the same
config from above, this does not work:

    $ sudo ifup eth1
    ifup: unknown interface eth1

You expect that ifupdown matches an interface given as argument to the
lists of interfaces in auto, allow-hotplug, etc, even without defining
them, as long as they are known by the kernel.

#982959#71
Date:
2021-10-08 07:32:41 UTC
From:
To:
ke 6. lokak. 2021 klo 15.19 Santiago Ruano Rincón
(santiagorr@riseup.net) kirjoitti:

Yes it is. Contrary to what the man page says, pattern matching does
not work for any "allow" line. It only works for "auto" lines.

That's the whole point of mapping patterns.

Martin-Éric

#982959#76
Date:
2021-10-08 08:52:02 UTC
From:
To:
El 08/10/21 a las 10:32, Martin-Éric Racine escribió:

Sorry for the confusion, I meant the problem is not explicitly related
to hotplug.
Pattern matching, as in the way how you use it, does not work either for
"auto" interfaces, as I described in my previous mail.

Yes. I was trying to ACKing the problem you describe.

The problem is when you call an ifupdown command for an interface
not-explicitly defined but that should match a configured pattern.
The behaviour is different when you call e.g. `ifup -a` or
`ifup --allow=hotplug -a`