diff options
author | Maciej <sppmacd@pm.me> | 2022-07-10 17:54:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-14 23:26:47 +0200 |
commit | 211ced3b65085632a1eb2c3a6346232f5df6b35f (patch) | |
tree | c7c44cb818105a9113c62876298e4e9002e79a5d /Userland/Services/NetworkServer/main.cpp | |
parent | 101c5566cb45306c882dd6e51fabf6bf567aa832 (diff) | |
download | serenity-211ced3b65085632a1eb2c3a6346232f5df6b35f.zip |
NetworkServer: Kill DHCPServer as the first thing done
The DHCPServer running while we setup interfaces might manage to setup
its own config before we kill it.
Diffstat (limited to 'Userland/Services/NetworkServer/main.cpp')
-rw-r--r-- | Userland/Services/NetworkServer/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Services/NetworkServer/main.cpp b/Userland/Services/NetworkServer/main.cpp index cdb3f367c0..db93a076ec 100644 --- a/Userland/Services/NetworkServer/main.cpp +++ b/Userland/Services/NetworkServer/main.cpp @@ -34,6 +34,10 @@ ErrorOr<int> serenity_main(Main::Arguments) JsonParser parser(data); JsonValue proc_net_adapters_json = TRY(parser.parse()); + // Kill all previously running DHCPServers that may manage to re-assign the IP + // address before we clear it manually. + MUST(Core::command("killall", { "DHCPClient" }, {})); + auto groups = config_file->groups(); dbgln("Interfaces to configure: {}", groups); @@ -89,7 +93,7 @@ ErrorOr<int> serenity_main(Main::Arguments) for (auto& iface : interfaces_with_dhcp_enabled) args.append(const_cast<char*>(iface.characters())); args.append(nullptr); - MUST(Core::command("killall", { "DHCPClient" }, {})); + auto dhcp_client_pid = TRY(Core::System::posix_spawnp("DHCPClient"sv, nullptr, nullptr, args.data(), environ)); TRY(Core::System::disown(dhcp_client_pid)); } |