Resolve TODO: Use IFLA_LINKINFO to detect tun/tap/wireguard/ppp interfaces#2242
Open
ayushrawat-10 wants to merge 2 commits intogreshake:masterfrom
Open
Resolve TODO: Use IFLA_LINKINFO to detect tun/tap/wireguard/ppp interfaces#2242ayushrawat-10 wants to merge 2 commits intogreshake:masterfrom
ayushrawat-10 wants to merge 2 commits intogreshake:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the previous sysfs-based interface type detection with a netlink-based implementation using IFLA_LINKINFO.
This resolves the existing inline TODO in netlink.rs:
// TODO: use netlink for these tooInterface types such as tun, tap, wireguard, and ppp are now detected directly from netlink attributes instead of relying on
/sys/class/net.Things Changed
The following logic was removed:
This eliminates filesystem access and string scanning for interface classification.
We now extract interface type from the IFLA_LINKINFO attribute:
Ifla::Linkinfo => link_type = extract_link_type(attr.payload().as_ref()),And a fucntion
fn extract_link_type(linkinfo_bytes: &[u8]) -> Option<String>Why This Change?
Everything is now derived directly from netlink data already being processed.
Impact
No functional changes are expected.
Interface classification now relies solely on netlink metadata instead of sysfs probing.