From df7b7cbfa43ba83808c2aa9e5034878f626454b1 Mon Sep 17 00:00:00 2001 From: Maciej Date: Fri, 1 Jul 2022 18:01:02 +0200 Subject: [PATCH] NetworkServer: Kill running DHCPServer before starting our own We cannot run two DHCPServers at once, let's just kill the one that was started previously. --- Userland/Services/NetworkServer/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Services/NetworkServer/main.cpp b/Userland/Services/NetworkServer/main.cpp index a398b9794b..4bbf3fe232 100644 --- a/Userland/Services/NetworkServer/main.cpp +++ b/Userland/Services/NetworkServer/main.cpp @@ -22,6 +22,7 @@ ErrorOr serenity_main(Main::Arguments) TRY(Core::System::unveil("/bin/DHCPClient", "x")); TRY(Core::System::unveil("/etc/Network.ini", "r")); TRY(Core::System::unveil("/bin/ifconfig", "x")); + TRY(Core::System::unveil("/bin/killall", "x")); TRY(Core::System::unveil("/bin/route", "x")); TRY(Core::System::unveil(nullptr, nullptr)); @@ -88,6 +89,7 @@ ErrorOr serenity_main(Main::Arguments) for (auto& iface : interfaces_with_dhcp_enabled) args.append(const_cast(iface.characters())); args.append(nullptr); + MUST(Core::command("killall", { "DHCPClient" }, {})); auto dhcp_client_pid = TRY(Core::System::posix_spawnp("DHCPClient", nullptr, nullptr, args.data(), environ)); TRY(Core::System::disown(dhcp_client_pid)); }