mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
nic_router: verbose_packet_drop attribute
The log messages covered by verbose_packet_drop were previously configured by the verbose attribute. This isn't the case anymore. Now, you can configure them as follows: ! <config verbose_packet_drop="no" ... > ! <domain verbose_packet_drop="no" ... /> ! <config/> The new attribute determines whether to log each packet drop and the rational behind it. The <config> value affects all domains without a <domain> local value. Issue #2857
This commit is contained in:
parent
e139c52262
commit
2733d3fea5
@ -481,6 +481,13 @@ Whether to log most important protocol header fields of each packet that is
|
||||
received or sent (ETH, IPv4, ARP, UDP, TCP, DHCP, ICMP). The <config> value
|
||||
affects all domains without a <domain> local value.
|
||||
|
||||
! <config verbose_packet_drop="no" ... >
|
||||
! <domain verbose_packet_drop="no" ... />
|
||||
! <config/>
|
||||
|
||||
Whether to log each packet drop and the rational behind it. The <config> value
|
||||
affects all domains without a <domain> local value.
|
||||
|
||||
! <config verbose_domain_state="no">
|
||||
|
||||
Whether to log most important changes in the state of a domain (number of NIC
|
||||
|
@ -155,6 +155,7 @@
|
||||
<xs:attribute name="interface" type="Ipv4_address_prefix" />
|
||||
<xs:attribute name="gateway" type="Ipv4_address" />
|
||||
<xs:attribute name="verbose_packets" type="Boolean" />
|
||||
<xs:attribute name="verbose_packet_drop" type="Boolean" />
|
||||
<xs:attribute name="label" type="Session_label" />
|
||||
<xs:attribute name="icmp_echo_server" type="Boolean" />
|
||||
</xs:complexType>
|
||||
@ -163,6 +164,7 @@
|
||||
</xs:choice>
|
||||
<xs:attribute name="verbose" type="Boolean" />
|
||||
<xs:attribute name="verbose_packets" type="Boolean" />
|
||||
<xs:attribute name="verbose_packet_drop" type="Boolean" />
|
||||
<xs:attribute name="verbose_domain_state" type="Boolean" />
|
||||
<xs:attribute name="dhcp_discover_timeout_sec" type="Seconds" />
|
||||
<xs:attribute name="dhcp_request_timeout_sec" type="Seconds" />
|
||||
|
@ -67,6 +67,7 @@ Configuration::Configuration(Env &env,
|
||||
_alloc(alloc),
|
||||
_verbose (node.attribute_value("verbose", false)),
|
||||
_verbose_packets (node.attribute_value("verbose_packets", false)),
|
||||
_verbose_packet_drop (node.attribute_value("verbose_packet_drop", false)),
|
||||
_verbose_domain_state (node.attribute_value("verbose_domain_state", false)),
|
||||
_icmp_echo_server (node.attribute_value("icmp_echo_server", true)),
|
||||
_dhcp_discover_timeout(read_sec_attr(node, "dhcp_discover_timeout_sec", DEFAULT_DHCP_DISCOVER_TIMEOUT_SEC)),
|
||||
|
@ -36,6 +36,7 @@ class Net::Configuration
|
||||
Genode::Allocator &_alloc;
|
||||
bool const _verbose { false };
|
||||
bool const _verbose_packets { false };
|
||||
bool const _verbose_packet_drop { false };
|
||||
bool const _verbose_domain_state { false };
|
||||
bool const _icmp_echo_server { true };
|
||||
Genode::Microseconds const _dhcp_discover_timeout { DEFAULT_DHCP_DISCOVER_TIMEOUT_SEC };
|
||||
@ -87,6 +88,7 @@ class Net::Configuration
|
||||
|
||||
bool verbose() const { return _verbose; }
|
||||
bool verbose_packets() const { return _verbose_packets; }
|
||||
bool verbose_packet_drop() const { return _verbose_packet_drop; }
|
||||
bool verbose_domain_state() const { return _verbose_domain_state; }
|
||||
bool icmp_echo_server() const { return _icmp_echo_server; }
|
||||
Genode::Microseconds dhcp_discover_timeout() const { return _dhcp_discover_timeout; }
|
||||
|
@ -205,6 +205,8 @@ Domain::Domain(Configuration &config, Xml_node const node, Allocator &alloc)
|
||||
Ipv4_address()),
|
||||
_verbose_packets(_node.attribute_value("verbose_packets",
|
||||
_config.verbose_packets())),
|
||||
_verbose_packet_drop(_node.attribute_value("verbose_packet_drop",
|
||||
_config.verbose_packet_drop())),
|
||||
_icmp_echo_server(_node.attribute_value("icmp_echo_server",
|
||||
_config.icmp_echo_server())),
|
||||
_label(_node.attribute_value("label", String<160>()).string())
|
||||
|
@ -93,6 +93,7 @@ class Net::Domain : public Domain_base,
|
||||
Genode::size_t _tx_bytes { 0 };
|
||||
Genode::size_t _rx_bytes { 0 };
|
||||
bool const _verbose_packets;
|
||||
bool const _verbose_packet_drop;
|
||||
bool const _icmp_echo_server;
|
||||
Genode::Session_label const _label;
|
||||
|
||||
@ -168,6 +169,7 @@ class Net::Domain : public Domain_base,
|
||||
***************/
|
||||
|
||||
bool verbose_packets() const { return _verbose_packets; }
|
||||
bool verbose_packet_drop() const { return _verbose_packet_drop; }
|
||||
bool icmp_echo_server() const { return _icmp_echo_server; }
|
||||
Genode::Session_label const &label() const { return _label; }
|
||||
Ipv4_config const &ip_config() const { return *_ip_config; }
|
||||
|
@ -1177,7 +1177,7 @@ void Interface::_handle_arp_reply(Ethernet_frame ð,
|
||||
Arp_waiter &waiter = *waiter_le->object();
|
||||
waiter_le = waiter_le->next();
|
||||
if (ip != waiter.ip()) { continue; }
|
||||
waiter.src()._continue_handle_eth(waiter.packet());
|
||||
waiter.src()._continue_handle_eth(local_domain, waiter.packet());
|
||||
destroy(waiter.src()._alloc, &waiter);
|
||||
}
|
||||
}
|
||||
@ -1284,13 +1284,14 @@ void Interface::_ready_to_submit()
|
||||
}
|
||||
|
||||
|
||||
void Interface::_continue_handle_eth(Packet_descriptor const &pkt)
|
||||
void Interface::_continue_handle_eth(Domain const &domain,
|
||||
Packet_descriptor const &pkt)
|
||||
{
|
||||
Size_guard size_guard(pkt.size());
|
||||
try { _handle_eth(_sink.packet_content(pkt), size_guard, pkt); }
|
||||
catch (Packet_postponed) {
|
||||
if (_config().verbose()) {
|
||||
log("[", _domain(), "] drop packet (handling postponed twice)"); }
|
||||
if (domain.verbose_packet_drop()) {
|
||||
log("[", domain, "] drop packet (handling postponed twice)"); }
|
||||
}
|
||||
_ack_packet(pkt);
|
||||
}
|
||||
@ -1381,7 +1382,7 @@ void Interface::_handle_eth(void *const eth_base,
|
||||
}
|
||||
}
|
||||
catch (Drop_packet exception) {
|
||||
if (_config().verbose()) {
|
||||
if (local_domain.verbose_packet_drop()) {
|
||||
log("[", local_domain, "] drop packet (",
|
||||
exception.reason, ")");
|
||||
}
|
||||
@ -1799,9 +1800,13 @@ void Interface::_ack_packet(Packet_descriptor const &pkt)
|
||||
|
||||
void Interface::cancel_arp_waiting(Arp_waiter &waiter)
|
||||
{
|
||||
if (_config().verbose()) {
|
||||
try { log("[", _domain(), "] drop packet (ARP got cancelled)"); }
|
||||
try {
|
||||
Domain &domain = _domain();
|
||||
if (domain.verbose_packet_drop()) {
|
||||
log("[", domain, "] drop packet (ARP got cancelled)"); }
|
||||
}
|
||||
catch (Pointer<Domain>::Invalid) {
|
||||
if (_config().verbose_packet_drop()) {
|
||||
log("[?] drop packet (ARP got cancelled)"); }
|
||||
}
|
||||
_ack_packet(waiter.packet());
|
||||
|
@ -239,7 +239,8 @@ class Net::Interface : private Interface_list::Element
|
||||
Size_guard &size_guard,
|
||||
Ipv4_packet &ip);
|
||||
|
||||
void _continue_handle_eth(Packet_descriptor const &pkt);
|
||||
void _continue_handle_eth(Domain const &domain,
|
||||
Packet_descriptor const &pkt);
|
||||
|
||||
Ipv4_address const &_router_ip() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user