log the reason for fw drops (#220)

* log the reason for fw drops

* only prepare log if we will end up sending it
This commit is contained in:
Patrick Bogen
2020-04-10 10:57:21 -07:00
committed by GitHub
parent fb252db4a1
commit 363c836422
4 changed files with 39 additions and 25 deletions

View File

@ -280,8 +280,10 @@ func (f *Interface) decryptToTun(hostinfo *HostInfo, messageCounter uint64, out
return
}
if f.firewall.Drop(out, *fwPacket, true, hostinfo, trustedCAs) {
dropReason := f.firewall.Drop(out, *fwPacket, true, hostinfo, trustedCAs)
if dropReason != nil && l.Level >= logrus.DebugLevel {
hostinfo.logger().WithField("fwPacket", fwPacket).
WithField("reason", dropReason).
Debugln("dropping inbound packet")
return
}