1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Kernel/Net: Get the correct interface type in SIOCGIFHWADDR ioctl

When calling ioctl on a socket with SIOCGIFHWADDR, return the correct
physical interface type. This value was previously hardcoded to
ARPHRD_ETHER (Ethernet), and now can also return ARPHRD_LOOPBACK for the
loopback adapter.
This commit is contained in:
Arda Cinar 2023-01-13 11:46:31 +03:00 committed by Jelle Raaijmakers
parent 6f9b84a64a
commit 037744e62a
5 changed files with 19 additions and 1 deletions

View file

@ -47,11 +47,17 @@ class NetworkAdapter
: public AtomicRefCounted<NetworkAdapter>
, public LockWeakable<NetworkAdapter> {
public:
enum class Type {
Loopback,
Ethernet
};
static constexpr i32 LINKSPEED_INVALID = -1;
virtual ~NetworkAdapter();
virtual StringView class_name() const = 0;
virtual Type adapter_type() const = 0;
virtual ErrorOr<void> initialize(Badge<NetworkingManagement>) = 0;
StringView name() const { return m_name->view(); }