nic_router: point to point IP config

This commit is contained in:
Martin Stein 2018-05-25 22:37:34 +02:00 committed by Christian Helmuth
parent 44d97986a2
commit 49dc2b264f
2 changed files with 9 additions and 6 deletions

View File

@ -27,8 +27,7 @@ Ipv4_config::Ipv4_config(Ipv4_address_prefix interface,
interface(interface), gateway(gateway), dns_server(dns_server)
{
if (!valid && (interface_valid || gateway_valid)) {
error("Bad IP configuration");
}
error("Bad IP configuration ", *this); }
}
@ -36,7 +35,7 @@ void Ipv4_config::print(Output &output) const
{
if (valid) {
Genode::print(output, "interface ", interface, ", gateway ", gateway,
", DNS server ", dns_server); }
", DNS server ", dns_server, " p2p ", point_to_point); }
else {
Genode::print(output, "none"); }
}

View File

@ -25,10 +25,14 @@ struct Net::Ipv4_config
bool const interface_valid { interface.valid() };
Ipv4_address const gateway { };
bool const gateway_valid { gateway.valid() };
bool const point_to_point { gateway_valid &&
interface_valid &&
interface.prefix == 32 };
Ipv4_address const dns_server { };
bool const valid { interface_valid &&
(!gateway_valid ||
interface.prefix_matches(gateway)) };
bool const valid { point_to_point ||
(interface_valid &&
(!gateway_valid ||
interface.prefix_matches(gateway))) };
Ipv4_config(Ipv4_address_prefix interface,
Ipv4_address gateway,