nic_router: conform log in Domain

In the domain class there were several places where output was generated
not conforming to the typical output format of the router ("[domain]
event: parameters").

Issue #2670
This commit is contained in:
Martin Stein 2018-04-03 13:48:09 +02:00 committed by Christian Helmuth
parent 87eb23f562
commit 8c7bbdecdf

View File

@ -78,9 +78,9 @@ void Domain::_read_forward_rules(Cstring const &protocol,
Forward_rule &rule = *new (_alloc) Forward_rule(domains, node); Forward_rule &rule = *new (_alloc) Forward_rule(domains, node);
rules.insert(&rule); rules.insert(&rule);
if (_config.verbose()) { if (_config.verbose()) {
log(" Forward rule: ", protocol, " ", rule); } log("[", *this, "] forward rule: ", protocol, " ", rule); }
} }
catch (Rule::Invalid) { warning("invalid forward rule"); } catch (Rule::Invalid) { log("[", *this, "] invalid forward rule"); }
}); });
} }
@ -96,7 +96,7 @@ void Domain::_read_transport_rules(Cstring const &protocol,
rules.insert(*new (_alloc) Transport_rule(domains, node, _alloc, rules.insert(*new (_alloc) Transport_rule(domains, node, _alloc,
protocol, _config)); protocol, _config));
} }
catch (Rule::Invalid) { warning("invalid transport rule"); } catch (Rule::Invalid) { log("[", *this, "] invalid transport rule"); }
}); });
} }
@ -118,11 +118,11 @@ Domain::Domain(Configuration &config, Xml_node const node, Allocator &alloc)
_config.verbose_packets()) _config.verbose_packets())
{ {
if (_name == Domain_name()) { if (_name == Domain_name()) {
error("Missing name attribute in domain node"); log("[?] Missing name attribute in domain node");
throw Invalid(); throw Invalid();
} }
if (!ip_config().valid && _node.has_sub_node("dhcp-server")) { if (!ip_config().valid && _node.has_sub_node("dhcp-server")) {
error("Domain cannot act as DHCP client and server at once"); log("[", *this, "] cannot act as DHCP client and server at once");
throw Invalid(); throw Invalid();
} }
if (_config.verbose_domain_state()) { if (_config.verbose_domain_state()) {
@ -248,7 +248,7 @@ void Domain::init(Domain_tree &domains)
_udp_port_alloc, _icmp_port_alloc, _udp_port_alloc, _icmp_port_alloc,
node)); node));
} }
catch (Rule::Invalid) { warning("invalid NAT rule"); } catch (Rule::Invalid) { log("[", *this, "] invalid NAT rule"); }
}); });
/* read ICMP rules */ /* read ICMP rules */
_node.for_each_sub_node("icmp", [&] (Xml_node const node) { _node.for_each_sub_node("icmp", [&] (Xml_node const node) {
@ -258,7 +258,7 @@ void Domain::init(Domain_tree &domains)
/* read IP rules */ /* read IP rules */
_node.for_each_sub_node("ip", [&] (Xml_node const node) { _node.for_each_sub_node("ip", [&] (Xml_node const node) {
try { _ip_rules.insert(*new (_alloc) Ip_rule(domains, node)); } try { _ip_rules.insert(*new (_alloc) Ip_rule(domains, node)); }
catch (Rule::Invalid) { warning("invalid IP rule"); } catch (Rule::Invalid) { log("[", *this, "] invalid IP rule"); }
}); });
} }