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:
14
inside.go
14
inside.go
@ -44,14 +44,17 @@ func (f *Interface) consumeInsidePacket(packet []byte, fwPacket *FirewallPacket,
|
||||
ci.queueLock.Unlock()
|
||||
}
|
||||
|
||||
if !f.firewall.Drop(packet, *fwPacket, false, hostinfo, trustedCAs) {
|
||||
dropReason := f.firewall.Drop(packet, *fwPacket, false, hostinfo, trustedCAs)
|
||||
if dropReason == nil {
|
||||
f.send(message, 0, ci, hostinfo, hostinfo.remote, packet, nb, out)
|
||||
if f.lightHouse != nil && *ci.messageCounter%5000 == 0 {
|
||||
f.lightHouse.Query(fwPacket.RemoteIP, f)
|
||||
}
|
||||
|
||||
} else if l.Level >= logrus.DebugLevel {
|
||||
hostinfo.logger().WithField("fwPacket", fwPacket).
|
||||
hostinfo.logger().
|
||||
WithField("fwPacket", fwPacket).
|
||||
WithField("reason", dropReason).
|
||||
Debugln("dropping outbound packet")
|
||||
}
|
||||
}
|
||||
@ -105,8 +108,11 @@ func (f *Interface) sendMessageNow(t NebulaMessageType, st NebulaMessageSubType,
|
||||
}
|
||||
|
||||
// check if packet is in outbound fw rules
|
||||
if f.firewall.Drop(p, *fp, false, hostInfo, trustedCAs) {
|
||||
l.WithField("fwPacket", fp).Debugln("dropping cached packet")
|
||||
dropReason := f.firewall.Drop(p, *fp, false, hostInfo, trustedCAs)
|
||||
if dropReason != nil && l.Level >= logrus.DebugLevel {
|
||||
l.WithField("fwPacket", fp).
|
||||
WithField("reason", dropReason).
|
||||
Debugln("dropping cached packet")
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user