vpn_status: Better VPN detection - prevent libvirt false-positive#2322
Merged
Conversation
Contributor
Author
|
CI failure might be because of an outdated Hatch version? I'm not exactly sure, I cannot reproduce it locally. |
Owner
|
Thanks a lot! |
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.
Fix #2321. A
tuninterface on Linux is more broad than just a VPN interface. It can also refer to interfaces used in a virtualized network (as shown in the issue). This PR uses a stronger VPN detection mechanism by making sure the interface is not marked as a port/slave in NetworkManager (indicating it is part of a broader virtualized network).We can't rely on the
Vpnproperty unfortunately because during testing, I found that an OpenVPN client does not have the VPN property marked as true in NetworkManager.Also mentioned in the issue, I added better parsing of the IPs for an interface so it doesn't fail if either IP key doesn't exist (instead it would just return None for the respective IP).