Clean up and adapt firewall package to recent changes

This commit is contained in:
Daniel
2019-10-25 13:35:25 +02:00
parent 25b1d59663
commit 4348caa258
8 changed files with 24 additions and 13 deletions

View File

@@ -167,8 +167,11 @@ func handlePacket(pkt packet.Packet) {
// }
// }
pkt.SetCtx(log.AddTracer(context.Background()))
log.Tracer(pkt.Ctx()).Tracef("firewall: handling packet: %s", pkt)
traceCtx, tracer := log.AddTracer(context.Background())
if tracer != nil {
pkt.SetCtx(traceCtx)
tracer.Tracef("firewall: handling packet: %s", pkt)
}
// associate packet to link and handle
link, created := network.GetOrCreateLinkByPacket(pkt)
@@ -340,7 +343,7 @@ func issueVerdict(pkt packet.Packet, link *network.Link, verdict network.Verdict
link.Unlock()
log.InfoTracef(pkt.Ctx(), "firewall: %s %s", link.Verdict, link)
log.Tracer(pkt.Ctx()).Infof("firewall: %s %s", link.Verdict, link)
}
// func tunnelHandler(pkt packet.Packet) {