mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
nic_router: config attribute 'mac_first'
The mac_first attribute tells the MAC-address allocator of the router from which MAC address to start allocating. This is useful, for instance, if you have nested nic_routers. In this case, identical MAC-allocator settings have led to name clashes in the past, so, you want to be able to configure them differently. Issue #2732
This commit is contained in:
parent
7b3343c2dc
commit
168407a40a
@ -124,7 +124,9 @@ Net::Root::Root(Entrypoint &ep,
|
||||
Root_component<Session_component>(&ep.rpc_ep(), &alloc), _timer(timer),
|
||||
_ep(ep), _router_mac(router_mac), _config(config), _buf_ram(buf_ram),
|
||||
_region_map(region_map), _interfaces(interfaces)
|
||||
{ }
|
||||
{
|
||||
Mac_allocator::mac_addr_base = config.mac_first();
|
||||
}
|
||||
|
||||
|
||||
Session_component *Net::Root::_create_session(char const *args)
|
||||
|
@ -40,6 +40,13 @@
|
||||
</xs:restriction>
|
||||
</xs:simpleType><!-- Domain_name -->
|
||||
|
||||
<xs:simpleType name="Mac_address">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:minLength value="11"/>
|
||||
<xs:maxLength value="17"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType><!-- Mac_address -->
|
||||
|
||||
<xs:simpleType name="Session_label">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:minLength value="1"/>
|
||||
@ -151,6 +158,7 @@
|
||||
</xs:element><!-- domain -->
|
||||
|
||||
</xs:choice>
|
||||
<xs:attribute name="mac_first" type="Mac_address" />
|
||||
<xs:attribute name="verbose" type="Boolean" />
|
||||
<xs:attribute name="verbose_packets" type="Boolean" />
|
||||
<xs:attribute name="verbose_domain_state" type="Boolean" />
|
||||
|
@ -52,6 +52,7 @@ Configuration::Configuration(Env &env,
|
||||
_udp_idle_timeout (read_sec_attr(node, "udp_idle_timeout_sec", DEFAULT_UDP_IDLE_TIMEOUT_SEC )),
|
||||
_tcp_idle_timeout (read_sec_attr(node, "tcp_idle_timeout_sec", DEFAULT_TCP_IDLE_TIMEOUT_SEC )),
|
||||
_tcp_max_segm_lifetime(read_sec_attr(node, "tcp_max_segm_lifetime_sec", DEFAULT_TCP_MAX_SEGM_LIFETIME_SEC)),
|
||||
_mac_first (mac_from_string(node.attribute_value("mac_first", Mac_string("02:02:02:02:02:00")).string())),
|
||||
_node(node)
|
||||
{
|
||||
/* read domains */
|
||||
|
@ -30,6 +30,8 @@ class Net::Configuration
|
||||
{
|
||||
private:
|
||||
|
||||
using Mac_string = Genode::String<17>;
|
||||
|
||||
Genode::Allocator &_alloc;
|
||||
bool const _verbose { false };
|
||||
bool const _verbose_packets { false };
|
||||
@ -41,6 +43,7 @@ class Net::Configuration
|
||||
Genode::Microseconds const _udp_idle_timeout { DEFAULT_UDP_IDLE_TIMEOUT_SEC };
|
||||
Genode::Microseconds const _tcp_idle_timeout { DEFAULT_TCP_IDLE_TIMEOUT_SEC };
|
||||
Genode::Microseconds const _tcp_max_segm_lifetime { DEFAULT_TCP_MAX_SEGM_LIFETIME_SEC };
|
||||
Mac_address const _mac_first { mac_from_string("02:02:02:02:02:00") };
|
||||
Pointer<Report> _report { };
|
||||
Pointer<Genode::Reporter> _reporter { };
|
||||
Domain_tree _domains { };
|
||||
@ -86,6 +89,7 @@ class Net::Configuration
|
||||
Domain_tree &domains() { return _domains; }
|
||||
Report &report() { return _report(); }
|
||||
Genode::Xml_node node() const { return _node; }
|
||||
Mac_address const &mac_first() const { return _mac_first; }
|
||||
};
|
||||
|
||||
#endif /* _CONFIGURATION_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user