On Wed, Feb 27, 2019 at 10:51:35AM +0100, Michael Biebl wrote: > > Even better, the plugin could > > just call system("/sbin/ifquery <iface name>") to check whether an > > interface is managed by ifupdown or not. > > If the idea is to load and run less code in NM, this would mean we have > to add more. So at a first glance this doesn't look very compelling. > > Also, if we wanted to find devices which should not be touched by NM > because they are defined in /e/n/i, is ifquery really sufficient to do that?
Yes. > Say I have a br0 and eth0 in bridge_ports. > What will ifquery eth0 return in such a case? If will return an error, because as far as ifupdown itself is concerned, no interface named eth0 has been defined. Ifupdown doesn't parse bridge_ports, this is instead handled by /etc/network/if-pre-up.d/bridge that's in the bridge-utils package. This is unfortunate, it is possible to make it more visible to ifupdown: for example, when bonding interfaces (which is similar to briding in the sense that you have a bond interface and some other interfaces connected to it), the ifenslave package provides an if-pre-up.d script that allows you to define a bond interface, and instead of using bond_slaves (the equivalent of bridge_ports), you can instead give slave interfaces their own iface definition in /e/n/i and add something like "bond_master bond0" to it. > Personally, I've never been a fan of the ifupdown plugin in NM. Parsing > the /e/n/i file is hairy and incomplete. It basically comes down to the fact that part of the parsing is done by the plugins, and that there's no way just by looking at /e/n/i to perfectly know which interfaces are controlled by ifupdown and which are not. > Especially the managed=true mode is something I would like to get rid off. > If we removed managed=true mode, all that would remain from the ifupdown > plugin is to mark devices as unmanaged by NM if they are defined in > /e/n/i. In such a case we might consider replacing the handwritten > parser and just exec ifquery. > Maybe this could even be replaced by a udev rule which runs ifquery and > sets ENV{NM_UNMANAGED}='1' Or maybe set ENV{MANAGER}='ifupdown', to support other ways of managing networks as well (ifupdown2, wicd, and probably more)? I like this approach of signalling through udev though, it completely decouples ifupdown from NetworkManager. I just did some testing, and just using ifquery as it is now will not be enough. The reason is that ifquery expects the name of a logical interface (ie, the name of an iface stanza), and not that of a physical interface. You can write something like: allow-hotplug /eth*=eth iface eth inet dhcp This will bring up any interface whose name starts with eth (so eth0, eth1, etc), and use the configuration of the iface eth stanza to configure them. In this case, "ifquery eth0" would always return an error, only "ifquery eth" would return zero. OTOH, if eth0 is up, then "ifquery --state eth0" would return 0, but "ifquery --state eth" would return an error. Not confusing enough? The above can still be solved by adding an option to ifquery to make it query a physical interface. But: you can also define VLAN interfaces but omit the VLAN trunk interface. Is the physical (trunk) interface then managed by ifupdown or not? -- Met vriendelijke groet / with kind regards, Guus Sliepen <g...@debian.org>
signature.asc
Description: PGP signature