summaryrefslogtreecommitdiff
path: root/Kernel/Net/Routing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Net/Routing.cpp')
-rw-r--r--Kernel/Net/Routing.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp
index feba06a32b..8c2396b3ad 100644
--- a/Kernel/Net/Routing.cpp
+++ b/Kernel/Net/Routing.cpp
@@ -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 {};
}));