From 3b38ed082fc93b0dcc547bea7c381c19c26838ca Mon Sep 17 00:00:00 2001 From: Arceliar Date: Fri, 25 Jun 2021 21:15:40 -0500 Subject: [PATCH] make failed sends a debug log, instead of error --- src/core/keystore.go | 6 ++++-- src/tuntap/iface.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/keystore.go b/src/core/keystore.go index 5062a67..21fb845 100644 --- a/src/core/keystore.go +++ b/src/core/keystore.go @@ -4,6 +4,7 @@ import ( "crypto/ed25519" "errors" "fmt" + "net" "sync" "time" @@ -278,7 +279,7 @@ func (k *keyStore) writePC(bs []byte) (int, error) { return 0, errors.New("not an IPv6 packet") // not IPv6 } if len(bs) < 40 { - strErr := fmt.Sprint("undersized IPv6 packet, length:", len(bs)) + strErr := fmt.Sprint("undersized IPv6 packet, length: ", len(bs)) return 0, errors.New(strErr) } var srcAddr, dstAddr address.Address @@ -290,7 +291,8 @@ func (k *keyStore) writePC(bs []byte) (int, error) { if srcAddr != k.address && srcSubnet != k.subnet { // This happens all the time due to link-local traffic // Don't send back an error, just drop it - return 0, nil + strErr := fmt.Sprint("incorrect source address: ", net.IP(srcAddr[:]).String()) + return 0, errors.New(strErr) } buf := make([]byte, 1+len(bs), 65535) buf[0] = typeSessionTraffic diff --git a/src/tuntap/iface.go b/src/tuntap/iface.go index 587c925..e72b091 100644 --- a/src/tuntap/iface.go +++ b/src/tuntap/iface.go @@ -18,7 +18,7 @@ func (tun *TunAdapter) read() { end := begin + n bs := buf[begin:end] if _, err := tun.core.Write(bs); err != nil { - tun.log.Errorln("Unable to send packet:", err) + tun.log.Debugln("Unable to send packet:", err) } } }