Improve firewall core logic, add prompt support via notifications

This commit is contained in:
Daniel
2019-03-08 23:15:36 +01:00
parent d596bd07ca
commit 5f21f7bc60
5 changed files with 372 additions and 128 deletions

View File

@@ -179,23 +179,8 @@ func initialHandler(pkt packet.Packet, link *network.Link) {
return
}
// check if communication needs reevaluation
if comm.NeedsReevaluation() {
comm.ResetVerdict()
}
// make a decision if not made already
switch comm.GetVerdict() {
case network.VerdictUndecided, network.VerdictUndeterminable:
DecideOnCommunication(comm, pkt)
}
switch comm.GetVerdict() {
case network.VerdictUndecided, network.VerdictUndeterminable, network.VerdictAccept:
DecideOnLink(comm, link, pkt)
default:
link.UpdateVerdict(comm.GetVerdict())
}
DecideOnCommunication(comm, pkt)
DecideOnLink(comm, link, pkt)
// log decision
logInitialVerdict(link)