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

feat(network): now supports ephemeral interfaces #2980

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Swivelgames
Copy link

@Swivelgames Swivelgames commented Jun 22, 2023

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Other: Replace this with a description of the type of this PR

Description

This updates the Network Module to allow for ephemeral networks. This is especially useful for virtual interfaces that come and go depending on whether or not an application has created it or not.

Additionally, this adds rudimentary support for wireguard in the net adapter, treating it as a tunnel. Because wireguard does not communicate connected state (given that it's a stealth VPN), the mere existence of the interface assumes that it is connected. Mullvad and MozillaVPN, for instance, create the interface when establishing connection, and discard the interface entirely when disconnecting, so this is a good indicator for that.

Related Issues & Documents

Fixes #1164
Fixes #1531

Documentation (check all applicable)

  • This PR requires changes to the Wiki documentation (describe the changes)
  • This PR requires changes to the documentation inside the git repo (please add them to the PR).
  • Does not require documentation changes

@Swivelgames
Copy link
Author

Can this get some love? :)

@Swivelgames
Copy link
Author

Swivelgames commented Nov 10, 2023

Just rebased from master branch. Rebuilt and everything is still working great 👍

Still using this as a daily driver, and it is highly stable.

@Swivelgames
Copy link
Author

Updated to latest from master. Still daily-driving without issues! 🎉

@1995parham
Copy link

Is it possible to do the same for tun devices. I think this should be more general.

@Swivelgames
Copy link
Author

Swivelgames commented Jan 17, 2024

@1995parham

Is it possible to do the same for tun devices. I think this should be more general.

The current implementation attempts to probe the interface. I'm assuming this isn't sufficient for tun devices right now?

memset(&request, 0, sizeof(request));
strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1);
data.cmd = ETHTOOL_GLINK;
request.ifr_data = reinterpret_cast<char*>(&data);
if (ioctl(*m_socketfd, SIOCETHTOOL, &request) == -1) {
return false;
}
return data.data != 0;

Do you have an open issue that you can reference for the issue you're running into?

@1995parham
Copy link

Thanks for your answer. It is not sufficient I think, because right now it cannot detect interface change (when VPN is off or on).

@Swivelgames
Copy link
Author

@1995parham Have you tried pulling down this PR and testing if it fixes your issue? A big portion of this PR was reorganizing src/modules/network.cpp so that it simply marks interfaces that it can't find as disconnected.

If this PR is insufficient, it might be good to create a new Issue ticket to encourage some discussion on how best to fix the issue. It's very possible that it could end up in this PR, or a fast-follow.

@1995parham
Copy link

I will do it and let you know.

@1995parham
Copy link

I've checked it. It works for me 😍 I think this MR deserve more attention. I will continue using it as my daily driver.

@Swivelgames
Copy link
Author

Hey @patrick96! Any chance we can get any traction on this? 🙂👍

lasercata added a commit to lasercata/Dotfiles that referenced this pull request Feb 26, 2024
Still need to reload every time the phone is plugged (would be solved with polybar/polybar#2980)
@BICH0
Copy link

BICH0 commented Apr 8, 2024

Why is this not in upstream!!

@Swivelgames
Copy link
Author

@BICH0 Unfortunately, this repo seems to be pretty slow moving. Most of the PRs, especially hotly-anticipated ones like #2868 that are out there right now have been hanging out for a couple of years now. The only PRs that seem to get much traction are related to brand new issue tickets. I don't think @patrick96 has notifications turned on for new PRs 😅

I tried sending him an email back in January, but I imagine it got filtered into his Spam folder.

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.

Wireguard support Do not disable network module if interface does not exist
3 participants