Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement interfaces selection like ifupdown1 #265

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

OlivierB
Copy link

This pull request (PR) is the third part of the changes originating from #235.

This PR requires the Makes "auto" an alias for "allow-auto" functionality from part 1 #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: #264). ifquery call will be useless.

Olivier BLIN added 4 commits June 16, 2023 10:32
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.
This variable is passed to multiple functions where interfaces are
expanded if a specific pattern is given.

Sometimes, functions forget to do the expand and fail to give a result...
Remaining expand in the code can be removed later without impact.
Use the new methods to create a standard interface selection for
ifup, ifdown, ifquery and ifreload operations.

ifquery and ifreload have a tricky implicit configuration, but I have
tried to not modify the ifupdown2 behavior in any way.

There is one changement on the -a/--all option that can be present or not
when implicit. Now, the `ifreload -a -c` command works for example.
Manage the IFLIST or -a/--all input for selection.
Early call of _preprocess_ifacenames to control interfaces.
Use --allow CLASS as a filter and not as an interfaces selector.
Olivier BLIN added 4 commits June 16, 2023 10:50
* The 'no ifaces found matching' exception has been replaced by a quiet early return
* The 'no ifaces found matching' exception has been replaced by a quiet early return
* The 'no ifaces found matching' exception has been replaced by a quiet early return
Reload operation uses a -a/--all option without --allow auto as default.
This command has an impact on ALL interfaces by default.

The --allow can be set to filter the targetted interfaces.

I do not really understand why the IFLIST is disable on this operation.
It could be very useful.
ifupdown1 and ifupdown2 man are missleading on the -a/--all option.
@OlivierB OlivierB marked this pull request as ready for review June 16, 2023 09:27
For ifupdown compatibility, '--all' implies '--allow auto'.
'--allow-all' parameter offers a way to have all interfaces without implicit filter.

On ifquery, --all is implicit when no interfaces are provided. So 'ifquery --allow-all'
shows information on all interfaces.
@OlivierB
Copy link
Author

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

  • ifup -a --allow-all sets up all interfaces on the system
  • ifquery --allow-all requests information on all interfaces (--all is implicit on ifquery)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant