From 054990aafa8cf77b30f18ae2017d8cee09efd046 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 6 Sep 2022 13:13:15 +0200 Subject: [PATCH] nic_router: fix net session aliases The Interface class of the router is an abstraction for NIC client sessions, NIC server sessions, and Uplink sessions. Nonetheless, Interface generally used to use the packet stream types of the Nic namespace and it worked because the Uplink packet stream types are factually the same (the are typedef'd from the same base type templates with the same parameters). The initial intention of this issue was to remove dependency on the diverse packet stream stream types from Interface. However, this turned out to be more tricky than thought. The Interface class calls function templates on the packet stream types, making a generic virtual interface impossible. And moving the calling code to the session classes as well would produce a lot of redundancy. Therefore, this commit removes only the use of the Nic namespace in the interface.* files by typedef'ing the packet stream types from the generic Genode type templates with the same parameters as in Nic and Uplink. Fixes #4385 --- repos/os/src/server/nic_router/interface.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/repos/os/src/server/nic_router/interface.h b/repos/os/src/server/nic_router/interface.h index 9661c3f160..7a45753c3f 100644 --- a/repos/os/src/server/nic_router/interface.h +++ b/repos/os/src/server/nic_router/interface.h @@ -24,7 +24,6 @@ #include /* Genode includes */ -#include #include #include @@ -32,10 +31,22 @@ namespace Genode { class Xml_generator; } namespace Net { - using Packet_descriptor = ::Nic::Packet_descriptor; - using Packet_stream_sink = ::Nic::Packet_stream_sink< ::Nic::Session::Policy>; - using Packet_stream_source = ::Nic::Packet_stream_source< ::Nic::Session::Policy>; - using Domain_name = Genode::String<160>; + enum { PKT_STREAM_QUEUE_SIZE = 1024 }; + + /* + * In order to be compliant to both the Uplink and the Nic packet stream + * types, we use the more base types from the Genode namespace here and + * combine them with the same parameters as in the Uplink and Nic + * namespaces. I.e., we assume the Uplink and Nic packet stream types to + * be factually the same although they are logically independent from each + * other. + */ + using Packet_descriptor = Genode::Packet_descriptor; + using Packet_stream_policy = Genode::Packet_stream_policy; + using Packet_stream_sink = Genode::Packet_stream_sink; + using Packet_stream_source = Genode::Packet_stream_source; + + using Domain_name = Genode::String<160>; class Ipv4_config; class Forward_rule_tree; class Transport_rule_list;