nic_router: downlinks use own router MAC address

Allocate a virtual MAC address at runtime that is used as router
Ethernet-identity for all downlink domains. This makes the downlink
domains independent from the uplink session.

Issue #2795
This commit is contained in:
Martin Stein 2018-04-27 13:51:04 +02:00 committed by Christian Helmuth
parent 41dbad13e4
commit e83f095fd2
4 changed files with 3 additions and 5 deletions

View File

@ -115,14 +115,13 @@ Net::Session_component::Session_component(Allocator &alloc,
Net::Root::Root(Entrypoint &ep,
Timer::Connection &timer,
Allocator &alloc,
Mac_address const &router_mac,
Configuration &config,
Ram_session &buf_ram,
Interface_list &interfaces,
Region_map &region_map)
:
Root_component<Session_component>(&ep.rpc_ep(), &alloc), _timer(timer),
_mac_alloc(config.mac_first()), _ep(ep), _router_mac(router_mac),
_mac_alloc(config.mac_first()), _ep(ep), _router_mac(_mac_alloc.alloc()),
_config(config), _buf_ram(buf_ram), _region_map(region_map),
_interfaces(interfaces)
{ }

View File

@ -157,7 +157,6 @@ class Net::Root : public Genode::Root_component<Session_component>
Root(Genode::Entrypoint &ep,
Timer::Connection &timer,
Genode::Allocator &alloc,
Mac_address const &router_mac,
Configuration &config,
Genode::Ram_session &buf_ram,
Interface_list &interfaces,

View File

@ -198,6 +198,7 @@ void Interface::_pass_prot(Ethernet_frame &eth,
void *const prot_base,
size_t const prot_size)
{
eth.src(_router_mac);
_update_checksum(prot, prot_base, prot_size, ip.src(), ip.dst(), ip.total_length());
_pass_ip(eth, size_guard, ip);
}
@ -416,7 +417,6 @@ void Interface::_adapt_eth(Ethernet_frame &eth,
new (_alloc) Arp_waiter(*this, remote_domain, hop_ip, pkt);
throw Packet_postponed();
}
eth.src(_router_mac);
}

View File

@ -41,7 +41,7 @@ class Net::Main
Reference<Configuration> _config { _init_config() };
Signal_handler<Main> _config_handler { _env.ep(), *this, &Main::_handle_config };
Uplink _uplink { _env, _timer, _heap, _interfaces, _config() };
Root _root { _env.ep(), _timer, _heap, _uplink.router_mac(), _config(), _env.ram(), _interfaces, _env.rm()};
Root _root { _env.ep(), _timer, _heap, _config(), _env.ram(), _interfaces, _env.rm()};
void _handle_config();