summaryrefslogtreecommitdiff
path: root/Userland/Services/NetworkServer
diff options
context:
space:
mode:
authorMaciej <sppmacd@pm.me>2022-07-01 17:26:14 +0200
committerSam Atkins <atkinssj@gmail.com>2022-07-09 09:22:25 +0100
commit8526c3f680e3e09c45e91e7fbccaed375d3f3412 (patch)
tree370578506d6307123891cd4fa92618ed8397da13 /Userland/Services/NetworkServer
parent20430ffeae78a89ddf55bd45c50661b39754251a (diff)
downloadserenity-8526c3f680e3e09c45e91e7fbccaed375d3f3412.zip
NetworkServer: Clear default gateway route entry before adding
Diffstat (limited to 'Userland/Services/NetworkServer')
-rw-r--r--Userland/Services/NetworkServer/main.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Services/NetworkServer/main.cpp b/Userland/Services/NetworkServer/main.cpp
index f20299c842..a398b9794b 100644
--- a/Userland/Services/NetworkServer/main.cpp
+++ b/Userland/Services/NetworkServer/main.cpp
@@ -73,8 +73,10 @@ ErrorOr<int> serenity_main(Main::Arguments)
// FIXME: Do this asynchronously
dbgln("Setting up interface {} statically ({}/{})", ifname, config.ipv4_address, config.ipv4_netmask);
MUST(Core::command("ifconfig", { "-a", ifname.characters(), "-i", config.ipv4_address.characters(), "-m", config.ipv4_netmask.characters() }, {}));
- if (config.ipv4_gateway != "0.0.0.0")
+ if (config.ipv4_gateway != "0.0.0.0") {
+ MUST(Core::command("route", { "del", "-n", "0.0.0.0", "-m", "0.0.0.0", "-i", ifname }, {}));
MUST(Core::command("route", { "add", "-n", "0.0.0.0", "-m", "0.0.0.0", "-g", config.ipv4_gateway, "-i", ifname }, {}));
+ }
}
}
});