From 66ab4d61a470d4ad7772ea69d436d70c0043191c Mon Sep 17 00:00:00 2001 From: Maciej Date: Sat, 30 Apr 2022 23:25:51 +0200 Subject: [PATCH] Kernel: Stop exposing gateway field It doesn't make sense after introduction of routing table which allows having multiple gateways for every interface, and isn't used by any of the userspace programs now. --- Kernel/GlobalProcessExposed.cpp | 4 ---- Kernel/Net/NetworkAdapter.cpp | 5 ----- Kernel/Net/NetworkAdapter.h | 3 --- Kernel/Net/NetworkTask.cpp | 1 - 4 files changed, 13 deletions(-) diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp index 7f2af55ba2c..3ae1ecb0081 100644 --- a/Kernel/GlobalProcessExposed.cpp +++ b/Kernel/GlobalProcessExposed.cpp @@ -55,10 +55,6 @@ private: auto ipv4_netmask = TRY(adapter.ipv4_netmask().to_string()); TRY(obj.add("ipv4_netmask", ipv4_netmask->view())); } - if (!adapter.ipv4_gateway().is_zero()) { - auto ipv4_gateway = TRY(adapter.ipv4_gateway().to_string()); - TRY(obj.add("ipv4_gateway", ipv4_gateway->view())); - } TRY(obj.add("packets_in", adapter.packets_in())); TRY(obj.add("bytes_in", adapter.bytes_in())); TRY(obj.add("packets_out", adapter.packets_out())); diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index 4c64f006345..cbc16764a90 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -159,9 +159,4 @@ void NetworkAdapter::set_ipv4_netmask(IPv4Address const& netmask) m_ipv4_netmask = netmask; } -void NetworkAdapter::set_ipv4_gateway(IPv4Address const& gateway) -{ - m_ipv4_gateway = gateway; -} - } diff --git a/Kernel/Net/NetworkAdapter.h b/Kernel/Net/NetworkAdapter.h index 8ccee2a6131..99c4ed60272 100644 --- a/Kernel/Net/NetworkAdapter.h +++ b/Kernel/Net/NetworkAdapter.h @@ -55,7 +55,6 @@ public: IPv4Address ipv4_address() const { return m_ipv4_address; } IPv4Address ipv4_netmask() const { return m_ipv4_netmask; } IPv4Address ipv4_broadcast() const { return IPv4Address { (m_ipv4_address.to_u32() & m_ipv4_netmask.to_u32()) | ~m_ipv4_netmask.to_u32() }; } - IPv4Address ipv4_gateway() const { return m_ipv4_gateway; } virtual bool link_up() { return false; } virtual i32 link_speed() { @@ -66,7 +65,6 @@ public: void set_ipv4_address(IPv4Address const&); void set_ipv4_netmask(IPv4Address const&); - void set_ipv4_gateway(IPv4Address const&); void send(MACAddress const&, ARPPacket const&); void fill_in_ipv4_header(PacketWithTimestamp&, IPv4Address const&, MACAddress const&, IPv4Address const&, IPv4Protocol, size_t, u8 type_of_service, u8 ttl); @@ -103,7 +101,6 @@ private: MACAddress m_mac_address; IPv4Address m_ipv4_address; IPv4Address m_ipv4_netmask; - IPv4Address m_ipv4_gateway; // FIXME: Make this configurable static constexpr size_t max_packet_buffers = 1024; diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 816d4e5f843..128b62fe0eb 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -67,7 +67,6 @@ void NetworkTask_main(void*) if (adapter.class_name() == "LoopbackAdapter"sv) { adapter.set_ipv4_address({ 127, 0, 0, 1 }); adapter.set_ipv4_netmask({ 255, 0, 0, 0 }); - adapter.set_ipv4_gateway({ 0, 0, 0, 0 }); } adapter.on_receive = [&]() {