From d22dc9ecc96d7434e33a7ec3205d5993034183f5 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 10 Oct 2024 09:23:13 +0100 Subject: [PATCH] TUN: Skip `ErrTooManySegments` --- src/tun/iface.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tun/iface.go b/src/tun/iface.go index 3a4c55f4..f1898281 100644 --- a/src/tun/iface.go +++ b/src/tun/iface.go @@ -1,5 +1,11 @@ package tun +import ( + "errors" + + wgtun "golang.zx2c4.com/wireguard/tun" +) + const TUN_OFFSET_BYTES = 80 // sizeof(virtio_net_hdr) func (tun *TunAdapter) read() { @@ -12,6 +18,10 @@ func (tun *TunAdapter) read() { for { n, err := tun.iface.Read(bufs, sizes, TUN_OFFSET_BYTES) if err != nil { + if errors.Is(err, wgtun.ErrTooManySegments) { + tun.log.Debugln("TUN segments dropped: %v", err) + continue + } tun.log.Errorln("Error reading TUN:", err) return }