diff options
author | Maciej <sppmacd@pm.me> | 2022-07-01 17:23:22 +0200 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-07-09 09:22:25 +0100 |
commit | bea1668159c413a601fa5319e276ede16322e590 (patch) | |
tree | bfa8faf18a4aafb5f9a1feba8063b63b5a3cdb26 /Kernel/Net/Routing.h | |
parent | 36676a1604de8b5868d4d9b154342a8349b50035 (diff) | |
download | serenity-bea1668159c413a601fa5319e276ede16322e590.zip |
Kernel/Net: Support removing route entries with unknown gateway
If you specify gateway as 0.0.0.0, the SIOCDELRT ioctl will remove all
route entries that match all the other arguments.
Diffstat (limited to 'Kernel/Net/Routing.h')
-rw-r--r-- | Kernel/Net/Routing.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Kernel/Net/Routing.h b/Kernel/Net/Routing.h index 3d68a0f34c..ba7f06f2d2 100644 --- a/Kernel/Net/Routing.h +++ b/Kernel/Net/Routing.h @@ -26,7 +26,12 @@ struct Route : public RefCounted<Route> { bool operator==(Route const& other) const { - return destination == other.destination && gateway == other.gateway && netmask == other.netmask && flags == other.flags && adapter.ptr() == other.adapter.ptr(); + return destination == other.destination && netmask == other.netmask && flags == other.flags && adapter.ptr() == other.adapter.ptr(); + } + + bool matches(Route const& other) const + { + return destination == other.destination && (gateway == other.gateway || other.gateway.is_zero()) && netmask == other.netmask && flags == other.flags && adapter.ptr() == other.adapter.ptr(); } const IPv4Address destination; |