From 49dc2b264f06f8b1ebe127ebc7c2d9c3dfdb1a43 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 25 May 2018 22:37:34 +0200 Subject: [PATCH] nic_router: point to point IP config --- repos/os/src/server/nic_router/ipv4_config.cc | 5 ++--- repos/os/src/server/nic_router/ipv4_config.h | 10 +++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/repos/os/src/server/nic_router/ipv4_config.cc b/repos/os/src/server/nic_router/ipv4_config.cc index 5200327140..39476adce1 100644 --- a/repos/os/src/server/nic_router/ipv4_config.cc +++ b/repos/os/src/server/nic_router/ipv4_config.cc @@ -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"); } } diff --git a/repos/os/src/server/nic_router/ipv4_config.h b/repos/os/src/server/nic_router/ipv4_config.h index e6e060bc5b..7966985b89 100644 --- a/repos/os/src/server/nic_router/ipv4_config.h +++ b/repos/os/src/server/nic_router/ipv4_config.h @@ -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,