Skip to content

Conversation

@Swivelgames
Copy link

@Swivelgames Swivelgames commented Jun 22, 2023

Tip

Arch Linux Users can get this feature now via polybar-wireguard-git
This AUR package is kept up to date with the latest version of polybar.

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 Swivelgames force-pushed the ephemeral-interfaces branch from 55a0d62 to 2ee52f3 Compare January 2, 2024 01:36
@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 Swivelgames force-pushed the ephemeral-interfaces branch from 88862bb to 32834a8 Compare April 10, 2024 07:21
@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.

@Swivelgames Swivelgames force-pushed the ephemeral-interfaces branch from 32834a8 to 61431d2 Compare August 19, 2024 22:29
@Swivelgames
Copy link
Author

Swivelgames commented Aug 19, 2024

Updated to latest. Still daily driving without problems.

Tip

Arch Linux Users can get this feature now via polybar-wireguard-git

I update my machine daily, and try to be timely when updating this branch as soon as I see a new version of polybar, so it should stay up to date and in sync with the upstream 👍

@Swivelgames
Copy link
Author

Updated to latest and pushed to polybar-wireguard-git. Still daily driving without problems.

Tip

Arch Linux Users can get this feature now via polybar-wireguard-git

@Swivelgames
Copy link
Author

Updated to latest and pushed to polybar-wireguard-git. Still daily driving without problems.

Tip

Arch Linux Users can get this feature now via polybar-wireguard-git

@Swivelgames
Copy link
Author

For those wondering, I'm still keeping this up to date. 👍

No recent updates to polybar, but when the next wave comes through, this branch will stay up to date 👍

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