From 0ed5655086737f44a986e5c0955a4b841df1672d Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 8 Oct 2019 10:57:22 +0200 Subject: [PATCH] nic_router: do DHCP when re-config to dynamic IP When re-configuring a domain from using a static IP config to using a dynamic IP config, attached interfaces didn't react with doing DHCP discover. This bug is fixed now and the nic_router_flood test was adapted in a way that it tests the described behavior. Fix #3518 --- repos/os/run/nic_router_flood.run | 115 ++++++++++++++------ repos/os/src/server/nic_router/interface.cc | 3 +- 2 files changed, 84 insertions(+), 34 deletions(-) diff --git a/repos/os/run/nic_router_flood.run b/repos/os/run/nic_router_flood.run index aaa2bde00c..2acb1c8ba1 100644 --- a/repos/os/run/nic_router_flood.run +++ b/repos/os/run/nic_router_flood.run @@ -24,10 +24,9 @@ create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/pkg/[drivers_nic_pkg] \ - [depot_user]/src/init \ - [depot_user]/src/nic_router + [depot_user]/src/init -build { app/ping test/net_flood } +build { app/ping test/net_flood server/nic_router server/dynamic_rom } install_config { @@ -63,39 +62,89 @@ install_config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + @@ -149,7 +198,7 @@ install_config { } -build_boot_image { test-net_flood ping } +build_boot_image { test-net_flood ping nic_router dynamic_rom } proc qemu_nic_model {} { if [have_spec x86] { return e1000 } diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index 3a5f695ea7..4d5e44339d 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -858,7 +858,7 @@ void Interface::handle_link_state() try { attach_to_domain_finish(); - /* if the wholde domain became down, discard IP config */ + /* if the whole domain is down, discard IP config */ Domain &domain_ = domain(); if (!link_state() && domain_.ip_config().valid) { domain_.interfaces().for_each([&] (Interface &interface) { @@ -1956,6 +1956,7 @@ void Interface::handle_config_3() /* if the IP configs differ, detach completely from the IP config */ if (old_domain.ip_config() != new_domain.ip_config()) { detach_from_ip_config(); + attach_to_domain_finish(); return; } /* if there was/is no IP config, there is nothing more to update */