@@ -41,8 +41,6 @@ type tunnelUpPMTUDData struct {
4141 // network is used to find the network level header overhead.
4242 // It can be [constants.UDP] or [constants.TCP].
4343 network string
44- // ipv6 is true if the VPN connection supports IPv6.
45- ipv6 bool
4644 // icmpAddrs is the list of addresses to use for ICMP path MTU discovery.
4745 // Each address should handle ICMP packets for PMTUD to work.
4846 icmpAddrs []netip.Addr
@@ -52,7 +50,8 @@ type tunnelUpPMTUDData struct {
5250}
5351
5452func (l * Loop ) onTunnelUp (ctx , loopCtx context.Context , data tunnelUpData ) {
55- switch vpnType := l .GetSettings ().Type ; vpnType {
53+ vpnSettings := l .GetSettings ()
54+ switch vpnType := vpnSettings .Type ; vpnType {
5655 case vpn .Wireguard , vpn .AmneziaWg :
5756 l .logger .Infof ("%s setup is complete. " +
5857 "Note %s is a silent protocol and it may or may not work, without giving any error message. " +
@@ -71,8 +70,9 @@ func (l *Loop) onTunnelUp(ctx, loopCtx context.Context, data tunnelUpData) {
7170
7271 if data .pmtud .enabled {
7372 mtuLogger := l .logger .New (log .SetComponent ("MTU discovery" ))
73+ ipv6 := l .isIPv6Used (vpnSettings )
7474 err := updateToMaxMTU (ctx , data .vpnIntf , data .pmtud .vpnType ,
75- data .pmtud .network , data . pmtud . ipv6 , data .pmtud .icmpAddrs , data .pmtud .tcpAddrs ,
75+ data .pmtud .network , ipv6 , data .pmtud .icmpAddrs , data .pmtud .tcpAddrs ,
7676 l .netLinker , l .routing , l .fw , mtuLogger )
7777 if err != nil {
7878 mtuLogger .Error (err .Error ())
0 commit comments