mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-14 23:43:56 +02:00
hotfix(pmtud): detect IPv6 usage in VPN connection
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"strings"
|
||||
|
||||
"github.com/jsimonetti/rtnetlink"
|
||||
"github.com/qdm12/gluetun/internal/pmtud/constants"
|
||||
@@ -28,10 +27,7 @@ func SrcAddr(dst netip.AddrPort, proto int) (src netip.AddrPort, cleanup func(),
|
||||
return netip.AddrPortFrom(srcAddr, srcPort), cleanup, nil
|
||||
}
|
||||
|
||||
var (
|
||||
errNoRoute = errors.New("no route to destination")
|
||||
ErrNetworkUnreachable = errors.New("network unreachable")
|
||||
)
|
||||
var errNoRoute = errors.New("no route to destination")
|
||||
|
||||
func srcIP(dst netip.Addr) (netip.Addr, error) {
|
||||
conn, err := rtnetlink.Dial(nil)
|
||||
@@ -54,9 +50,6 @@ func srcIP(dst netip.Addr) (netip.Addr, error) {
|
||||
}
|
||||
messages, err := conn.Route.Get(requestMessage)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "network is unreachable") {
|
||||
err = ErrNetworkUnreachable
|
||||
}
|
||||
return netip.Addr{}, fmt.Errorf("getting routes to %s: %w", dst, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user