Skip to content

Commit c189df0

Browse files
committed
ipn/wg: TNT on net.ErrClosed
1 parent 145d1fe commit c189df0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

intra/ipn/wgproxy.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"encoding/base64"
2222
"encoding/binary"
23+
"errors"
2324
"fmt"
2425
"net"
2526
"net/netip"
@@ -1597,6 +1598,13 @@ func (h *wgtun) listener(op wg.PktDir, err error) {
15971598
} else if op == wg.Rcv && timedout(err) {
15981599
s = TZZ // writes and reads have succeeded in the recent past
15991600
why = "TZZ: read timeout"
1601+
} else if errors.Is(err, net.ErrClosed) {
1602+
// github.com/WireGuard/wireguard-go/blob/f333402bd9cb/device/receive.go#L112
1603+
// on net.ErrClosed, wg stops recieving routine for all peers; this among
1604+
// other things mean that the wg.Device is effectively down and would not
1605+
// recieve any incoming messages (nor outgoing as those use the same socket)
1606+
s = TNT
1607+
why = "TNT: closed " + string(op)
16001608
} else {
16011609
s = TKO
16021610
why = "TKO: " + err.Error()

0 commit comments

Comments
 (0)