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

internal/wglinux: multicast group listener #120

Open
elwhite321 opened this issue Mar 24, 2022 · 4 comments
Open

internal/wglinux: multicast group listener #120

elwhite321 opened this issue Mar 24, 2022 · 4 comments

Comments

@elwhite321
Copy link

I have a use case where the user program using wgctrl-go needs control over the WireGuard kernel devices. If the wg, ip or similar CLIs are used to change a device, the user program will be out of sync.

What are the thoughts around implementing a multicast group client to update the devices as they change? Does this feature / enhancement justify the discontinuity between the user land device(s)?

I'd be happy to look into this if it makes sense.

@mdlayher
Copy link
Member

As of today, wireguard genetlink does not expose any multicast groups:

$ uname -a
Linux matt-3 5.13.0-37-generic #42-Ubuntu SMP Tue Mar 15 14:34:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ genl ctrl get name wireguard

Name: wireguard
        ID: 0x22  Version: 0x1  header size: 0  max attribs: 8 
        commands supported: 
                #1:  ID-0x0 
                #2:  ID-0x1 

And listening for device changes made by iproute2 would be an rtnetlink operation, which is out of scope for this library.

I don't think there is anything that can be done here today. But maybe notifying on device configuration changes is something that @zx2c4 could consider for the WireGuard kernel module.

@mdlayher mdlayher changed the title Netlink / genelting multicast group listener internal/wglinux: multicast group listener Mar 24, 2022
@elwhite321
Copy link
Author

Thank you for correcting the title.

I have seen this patch but am unsure of the status. Maybe something for the future.

I was going to open another issue for adding and removing devices. This would also require rtnetlink, and thus I assume out of the scope too?

@mdlayher
Copy link
Member

Thanks for the patch link.

That's correct: adding and removing devices is out of scope for this library since it ultimately relies on an entirely separate set of APIs.

@stv0g
Copy link
Contributor

stv0g commented Aug 16, 2022

I've implemented a package which watches interfaces using wgctrl and allows you to register callbacks for various events:

https://github.com/stv0g/wice/tree/master/pkg/watcher

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

No branches or pull requests

3 participants