nic_router: support domain-local IPv4

If an IPv4 packet targets an IP local to the domain it comes from and doesn't
target the routers IP of that domain, forward it to all other interfaces of
the domain without considering any other routing.

Issue #2609
This commit is contained in:
Martin Stein 2017-11-13 23:26:37 +01:00 committed by Christian Helmuth
parent b63d83e6a3
commit f524fb8e61

View File

@ -562,6 +562,18 @@ void Interface::_handle_ip(Ethernet_frame &eth,
Ipv4_packet &ip = *new (eth.data<void>())
Ipv4_packet(eth_size - sizeof(Ethernet_frame));
/* try handling subnet-local IP packets */
if (_ip_config().interface.prefix_matches(ip.dst()) &&
ip.dst() != _router_ip())
{
/*
* Packet targets IP local to the domain's subnet and doesn't target
* the router. Thus, forward it to all other interfaces of the domain.
*/
_domain_broadcast(eth, eth_size);
return;
}
/* try to route via transport layer rules */
try {
L3_protocol const prot = ip.protocol();