mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-10 04:30:20 +02:00
hotfix(pmtud): only set MSS on non-local VPN routes
This commit is contained in:
+12
-1
@@ -50,6 +50,8 @@ func (r *Routing) VPNLocalGatewayIP(vpnIntf string) (ip netip.Addr, err error) {
|
|||||||
|
|
||||||
var ErrVPNRouteNotFound = errors.New("VPN route not found")
|
var ErrVPNRouteNotFound = errors.New("VPN route not found")
|
||||||
|
|
||||||
|
// VPNRoutes returns the routes that are using the VPN interface, excluding local routes
|
||||||
|
// and link-local multicast and unicast routes.
|
||||||
func (r *Routing) VPNRoutes(vpnIntf string) (routes []netlink.Route, err error) {
|
func (r *Routing) VPNRoutes(vpnIntf string) (routes []netlink.Route, err error) {
|
||||||
vpnLink, err := r.netLinker.LinkByName(vpnIntf)
|
vpnLink, err := r.netLinker.LinkByName(vpnIntf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -63,7 +65,16 @@ func (r *Routing) VPNRoutes(vpnIntf string) (routes []netlink.Route, err error)
|
|||||||
}
|
}
|
||||||
routes = make([]netlink.Route, 0, len(allRoutes))
|
routes = make([]netlink.Route, 0, len(allRoutes))
|
||||||
for _, route := range allRoutes {
|
for _, route := range allRoutes {
|
||||||
if route.LinkIndex == vpnLinkIndex {
|
const localTable = 255
|
||||||
|
switch {
|
||||||
|
case route.LinkIndex != vpnLinkIndex,
|
||||||
|
route.Table == localTable:
|
||||||
|
continue
|
||||||
|
case !route.Dst.IsValid(), route.Dst.Addr().IsUnspecified():
|
||||||
|
routes = append(routes, route)
|
||||||
|
case route.Dst.Addr().IsLinkLocalMulticast(), route.Dst.Addr().IsLinkLocalUnicast():
|
||||||
|
continue
|
||||||
|
case !route.Dst.Addr().IsPrivate():
|
||||||
routes = append(routes, route)
|
routes = append(routes, route)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user