-
-
Notifications
You must be signed in to change notification settings - Fork 513
feat(vpn): path MTU discovery to find the best MTU #2586
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
base: master
Are you sure you want to change the base?
Conversation
It is not reliable? See qdm12/gluetun#2533 maybe.
|
Tested this with ProtonVPN using Wireguard, doesn't work for me: |
|
Can you try re-pulling the image and see if it works? It should now fallback on the more-bruteforcey method of finding the MTU, if PMTUD isn't allowed by their firewall. |
|
Tried it out and the feature seems to fall back to the minimum MTU of 68: However, when I connect a |
|
hi, thank for your hard work ! |
|
@tribut can you run with LOG_LEVEL=debug? 68 is the minimum MTU possible, that's odd. |
|
I've tried again with But when the VPN is healthy on first connect, it's stuck on 68: I've restarted it a few times and this appears to be reproducible. |
|
is there a wiki explaining how to do this |
|
Ok so
Now I'm a bit confused by this, this is not happening for me or @DrummyFloyd so that's kind of odd! I'm wondering if all MTU testing fail (like above), maybe because ICMP is blocked 🤔 So it's healthy (i.e. for https etc.) but not ICMP 🤔 🤔 That would indicate we definitely need a backup mechanism if ICMP is blocked, for example default to 1300. @strunzoz run the container image with tag |
|
the previous container image was bugged, it's now fixed. New additions:
All in all, I think this should work in all situations now:
|
|
@tribut let me know if you still are facing issues 🙏 Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements path MTU discovery (PMTUD) for VPN connections to automatically find the optimal MTU size. The implementation adds a new pmtud package that performs ICMP-based MTU discovery for both IPv4 and IPv6 connections, with fallback mechanisms when ICMP is blocked.
Key changes:
- New
pmtudpackage with IPv4/IPv6 MTU discovery using ICMP packets - Integration of PMTUD into VPN tunnel setup process
- Refactoring of VPN setup functions to return full connection objects instead of individual fields
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/pmtud/*.go | New package implementing path MTU discovery with ICMP probing and binary search fallback |
| internal/vpn/tunnelup.go | Integration of MTU discovery into tunnel setup process |
| internal/vpn/wireguard.go | Refactored to return connection object instead of individual fields |
| internal/vpn/openvpn.go | Refactored to return connection object instead of individual fields |
| internal/vpn/run.go | Updated to use connection object from setup functions |
| internal/vpn/interfaces.go | Added LinkSetMTU method to Linker interface |
| internal/netlink/link.go | Implementation of LinkSetMTU method |
| cmd/gluetun/main.go | Added LinkSetMTU to Linker interface |
Comments suppressed due to low confidence (1)
internal/pmtud/ipv4.go:1
- Using panic for invalid IP version is inappropriate in this context. This should return an error instead of panicking, as invalid input should be handled gracefully.
package pmtud
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Add `VPN_PMTUD` option enabled by default - One can revert to use `VPN_PMTUD=off` to disable the new PMTUD mechanism
Can't reproduce the problem with the latest changes. Thanks. |
Run with image tag
pr-2586that's it 😉Fix #2570
netlink. This is blocking otherwise other network operations would fail in parallel, due to the temporary high MTU set on the link.Note for Openvpn, mssfix might still have an impact on changing the mtu