CumulusNetworks / ifupdown2

GNU General Public License v2.0
161 stars 75 forks source link

Implement interfaces selection like ifupdown1 #265

Open OlivierB opened 1 year ago

OlivierB commented 1 year ago

This pull request (PR) is the third part of the changes originating from https://github.com/CumulusNetworks/ifupdown2/pull/235.

This PR requires the Makes "auto" an alias for "allow-auto" functionality from part 1 https://github.com/CumulusNetworks/ifupdown2/pull/263 to work without regressions.

ifupdown2 does not exactly respect ifupdown1 interfaces selection. It is a bit messed up between auto/all/allow/IFLIST.

In ifupdown1, you must provide a -a/--all or IFLIST (except for query -l command). The --allow CLASSes are used for filtering interfaces to modify. The -a/--all command set an 'auto' CLASS if no allowed CLASS are provided.

ifup -a command, UP all interfaces with the auto CLASS. ifup eth1 command, UP eth1 interface (no CLASS filtering). ifup -a --allow special, only UP interfaces with the special CLASS. ifup --allow hotplug eth4, only UP eth4 interface if it has the hotplug CLASS.

For query command, the -a/--all is implicit.

In ifupdown2, the --allow CLASS is used as a way to retrieve interfaces. ifup/ifdown neither --allow hotplug eth4 nor -a --allow special work. ifquery command returns duplicate interfaces in output.

Futhermore, these modifications will allow us to simplify ifup/ifdown calls in hotplug PR (Part 2: https://github.com/CumulusNetworks/ifupdown2/pull/264). ifquery call will be useless.

OlivierB commented 9 months ago

My last commit adds support to request information on all interfaces (even if auto is not set):