diff options
Diffstat (limited to '6/firewall.pl')
-rw-r--r-- | 6/firewall.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/6/firewall.pl b/6/firewall.pl index d76e2d1..b2ae64a 100644 --- a/6/firewall.pl +++ b/6/firewall.pl @@ -4,6 +4,7 @@ :- module(firewall, [ fw_rule/2, + warning/1, retract_all_from/1]). :- use_module(hosts, [ @@ -11,7 +12,10 @@ :- dynamic fw_rule/2. -rule_is_from(fw_rule(_, Attr), From) :- Attr.from=From. +warning(Msg) :- + fw_rule(Host, Attr), + \+ (_{from:_} :< Attr), + format(string(Msg), "Missing 'from' on fw_rule for host '~w', ~w", [Host, Attr]). rules_from(From, Rules) :- findall(fw_rule(Host, Attr), (fw_rule(Host, Attr), Attr.from=From), Rules). |