Skip to content

Revert "Use interface index instead of name in libconfig"#81

Merged
apconole merged 1 commit intointel:masterfrom
apconole:ifnames_correction
Feb 23, 2022
Merged

Revert "Use interface index instead of name in libconfig"#81
apconole merged 1 commit intointel:masterfrom
apconole:ifnames_correction

Conversation

@apconole
Copy link
Contributor

This reverts commit e272d34.

During production, it was found that the ifindex can be unstable.
See discussion at #3

Signed-off-by: Aaron Conole aconole@redhat.com

This reverts commit e272d34.

During production, it was found that the ifindex can be unstable.
See discussion at intel#3

Signed-off-by: Aaron Conole <aconole@redhat.com>
@apconole
Copy link
Contributor Author

NOTE: I haven't done any testing with this revert - this proposal needs some vetting before merging it.

@apconole
Copy link
Contributor Author

apconole commented Jan 4, 2022

@penguin359 see the discussion - I think @srlawton and @dmertman agreed we need to revert this patch and work on a new proposal for handling interface lookups from configurations. There is no guarantee about ifindex and some naming daemons (like those present in systemd) can make ifnames not match with ifindex on boot. This popped up at a customer site. Maybe @gonzoleeman can also look?

@apconole
Copy link
Contributor Author

There is another good reason to revert this change, the test cases in the test/ directory rely on ifname.

I plan to apply this revert in a week and push if I don't get any response.

@penguin359
Copy link
Contributor

Yes, ifindex is not designed to be a unique identifier across reboots. Instead, it's designed to be the unique ID for an interface to follow during a single boot of the kernel. During a single boot of the kernel, they are given out serially and used only once. It will track the interface from the first instance it's registered as a netdev and through any configuration and renaming such as when SystemD renamed eth0 to enp2s3f0 and so on until the netdev is unregistered or system shutdown. If a driver for an interface is unloaded and reloaded, the old interface index will not be re-used and a new one will be given to it. Also, since they are given out serially, it's possible a new NIC added between boots will be discovered in between the existing list of interfaces bumping later ones up. The only way to truly track an interface across system reboots is by relying on either it's hardware MAC address or it interface name using the SystemD Predictable Network Interface Names.

The ifindex can be useful for tracking an interface across any renaming that the user might choose to do during this boot, but it can't be relied upon for tracking the interface beyond the life of the current boot and probably not more than the life of the daemon. It should be rediscovered at start-up from the known, previous interface name. Also, if an interface disappears because the superuser is upgrading the network driver, that interface might reappear later, but with a new ifindex since they are never re-used in one boot. It's primary use would simply be to retain a netdev's configuration after a rename.

@apconole apconole merged commit 12655ae into intel:master Feb 23, 2022
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.

2 participants