nic_router: intf. con/destruct reports link state

Creating and destructing an interface was not considered a change of its real
link state as defined in the description of the <report link_state_triggers="">
config attribute in the router's README. In case of Uplink sessions this is
obviously a problem as they communicate their real link state through session
lifetime. But also in case of NIC sessions it's a possible to create an
interface that is immediately "up" after creation or destruct an interface
without its link state going "down" beforehand.

Taking into account also the practical application of the
<report link_state_triggers=""> attribute, reporting only on destruction and
construction of interfaces that are "up" seems shorthanded. This is because a
report-receiver most likely needs to be able to synchronize the lifetime of
the objects that keep track of the link states with the lifetime of the
corresponding sessions.

That said, with this commit, the router triggers a report update on each
session construction/destruction when <report link_state_triggers=""> is
set.

Fixes #4462
This commit is contained in:
Martin Stein 2022-09-07 20:24:10 +02:00 committed by Norman Feske
parent aff1db1543
commit 79cc9af212
3 changed files with 10 additions and 6 deletions

View File

@ -720,10 +720,10 @@ information on that, refer to [Behavior regarding the NIC-session link state].
'link_state_triggers'
A boolean value that controls whether to enforce sending a report each time the
state that is controlled through the 'link_state' attribute of the <report> tag
changes. I.e., whenever the real link state of any interface at the router has
changed.
A boolean value that controls whether to enforce sending a report whenever the
real link state (see description of the 'link_state' attribute) of any
interface at the router has changed. Note that whenever an interface is created
or destroyed this is considered a change of its real link state.
'interval_sec'

View File

@ -1923,6 +1923,8 @@ Interface::Interface(Genode::Entrypoint &ep,
_interfaces { interfaces }
{
_interfaces.insert(this);
try { _config().report().handle_interface_link_state(); }
catch (Pointer<Report>::Invalid) { }
}
@ -2375,6 +2377,8 @@ void Interface::cancel_arp_waiting(Arp_waiter &waiter)
Interface::~Interface()
{
try { _config().report().handle_interface_link_state(); }
catch (Pointer<Report>::Invalid) { }
_detach_from_domain();
_interfaces.remove(this);
}

View File

@ -106,8 +106,8 @@ Net::Uplink_session_component::Uplink_session_component(Session_env
_rx.sigh_ack_avail (_interface.pkt_stream_signal_handler());
/*
* We do not install ready_to_submit because submission is only triggered by
* incoming packets (and dropped if the submit queue is full).
* We do not install ready_to_submit because submission is only triggered
* by incoming packets (and dropped if the submit queue is full).
* The ack queue should never be full otherwise we'll be leaking packets.
*/
}