Closed apconole closed 2 years ago
NOTE: I haven't done any testing with this revert - this proposal needs some vetting before merging it.
@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?
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.
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.
This reverts commit e272d34f45bc15d52424228f824c1ad96932867e.
During production, it was found that the ifindex can be unstable. See discussion at https://github.com/intel/openlldp/pull/3
Signed-off-by: Aaron Conole aconole@redhat.com