mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:07:34 +00:00
NetworkServer: Disable interface if Enabled = false
We now remove default route and set IP address to 0.0.0.0 (Kernel interprets this as "link down") for all disabled interfaces, so that a reboot is no longer needed.
This commit is contained in:
parent
211ced3b65
commit
b5708a084b
1 changed files with 6 additions and 0 deletions
|
@ -83,8 +83,14 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
MUST(Core::command("route"sv, { "add", "-n", "0.0.0.0", "-m", "0.0.0.0", "-g", config.ipv4_gateway, "-i", ifname }, {}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// FIXME: Propagate errors
|
||||
dbgln("Disabling interface {}", ifname);
|
||||
MUST(Core::command("route", { "del", "-n", "0.0.0.0", "-m", "0.0.0.0", "-i", ifname }, {}));
|
||||
MUST(Core::command("ifconfig", { "-a", ifname.characters(), "-i", "0.0.0.0", "-m", "0.0.0.0" }, {}));
|
||||
}
|
||||
});
|
||||
|
||||
if (!interfaces_with_dhcp_enabled.is_empty()) {
|
||||
dbgln("Running DHCPClient for interfaces: {}", interfaces_with_dhcp_enabled);
|
||||
Vector<char*> args;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue