Don't indefinitely block TUN/TAP reader goroutine when a conn error happens

This commit is contained in:
Neil Alexander 2019-05-30 12:44:47 +01:00
parent 396c879d0f
commit 9e086e70f0
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 8 additions and 3 deletions

View file

@ -207,7 +207,7 @@ func (c *Conn) Read(b []byte) (int, error) {
defer close(done)
// If the nonce is bad then drop the packet and return an error
if !sinfo.nonceIsOK(&p.Nonce) {
err = errors.New("packet dropped due to invalid nonce")
err = ConnError{errors.New("packet dropped due to invalid nonce"), false, true, 0}
return
}
// Decrypt the packet