summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2021-03-30 12:36:59 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-03-30 12:41:43 -0700
commit6228659a9136014c5a96c2a4f9f5e3678b0d1e08 (patch)
tree63310c1ab99233a9f1835353709c5402927f2dc2
parentconn: document retry loop in StdNetBind.Open (diff)
downloadwireguard-go-6228659a9136014c5a96c2a4f9f5e3678b0d1e08.tar.xz
wireguard-go-6228659a9136014c5a96c2a4f9f5e3678b0d1e08.zip
device: handle broader range of errors in RoutineReceiveIncoming
RoutineReceiveIncoming exits immediately on net.ErrClosed, but not on other errors. However, for errors that are known to be permanent, such as syscall.EAFNOSUPPORT, we may as well exit immediately instead of retrying. This considerably speeds up the package device tests right now, because the Bind sometimes (incorrectly) returns syscall.EAFNOSUPPORT instead of net.ErrClosed. Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
-rw-r--r--device/receive.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/device/receive.go b/device/receive.go
index b1959c6..5ddb66c 100644
--- a/device/receive.go
+++ b/device/receive.go
@@ -104,6 +104,9 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind conn.Bind) {
if errors.Is(err, net.ErrClosed) {
return
}
+ if neterr, ok := err.(net.Error); ok && !neterr.Temporary() {
+ return
+ }
device.log.Errorf("Failed to receive packet: %v", err)
if deathSpiral < 10 {
deathSpiral++