mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-22 07:57:31 +00:00
TUN: Skip ErrTooManySegments
This commit is contained in:
parent
874083da79
commit
d22dc9ecc9
@ -1,5 +1,11 @@
|
|||||||
package tun
|
package tun
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
wgtun "golang.zx2c4.com/wireguard/tun"
|
||||||
|
)
|
||||||
|
|
||||||
const TUN_OFFSET_BYTES = 80 // sizeof(virtio_net_hdr)
|
const TUN_OFFSET_BYTES = 80 // sizeof(virtio_net_hdr)
|
||||||
|
|
||||||
func (tun *TunAdapter) read() {
|
func (tun *TunAdapter) read() {
|
||||||
@ -12,6 +18,10 @@ func (tun *TunAdapter) read() {
|
|||||||
for {
|
for {
|
||||||
n, err := tun.iface.Read(bufs, sizes, TUN_OFFSET_BYTES)
|
n, err := tun.iface.Read(bufs, sizes, TUN_OFFSET_BYTES)
|
||||||
if err != nil {
|
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)
|
tun.log.Errorln("Error reading TUN:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user