mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Kernel+route: Support global routing table deletion
This commit is contained in:
parent
863c14c4f4
commit
0866a0cd1e
3 changed files with 21 additions and 8 deletions
|
@ -142,7 +142,6 @@ ErrorOr<void> update_routing_table(IPv4Address const& destination, IPv4Address c
|
|||
return ENOMEM;
|
||||
|
||||
TRY(routing_table().with([&](auto& table) -> ErrorOr<void> {
|
||||
// TODO: Add support for deleting routing entries
|
||||
if (update == UpdateTable::Set) {
|
||||
for (auto const& route : table) {
|
||||
if (route == *route_entry)
|
||||
|
@ -150,6 +149,15 @@ ErrorOr<void> update_routing_table(IPv4Address const& destination, IPv4Address c
|
|||
}
|
||||
table.append(*route_entry);
|
||||
}
|
||||
if (update == UpdateTable::Delete) {
|
||||
for (auto& route : table) {
|
||||
if (route == *route_entry) {
|
||||
table.remove(route);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return ESRCH;
|
||||
}
|
||||
return {};
|
||||
}));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue