mirror of
https://github.com/SerenityOS/serenity
synced 2024-11-05 17:46:52 +00:00
037744e62a
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.
31 lines
889 B
C++
31 lines
889 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Kernel/Net/NetworkAdapter.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class LoopbackAdapter final : public NetworkAdapter {
|
|
private:
|
|
LoopbackAdapter(NonnullOwnPtr<KString>);
|
|
|
|
public:
|
|
static LockRefPtr<LoopbackAdapter> try_create();
|
|
virtual ~LoopbackAdapter() override;
|
|
|
|
virtual ErrorOr<void> initialize(Badge<NetworkingManagement>) override { VERIFY_NOT_REACHED(); }
|
|
|
|
virtual void send_raw(ReadonlyBytes) override;
|
|
virtual StringView class_name() const override { return "LoopbackAdapter"sv; }
|
|
virtual Type adapter_type() const override { return Type::Loopback; }
|
|
virtual bool link_up() override { return true; }
|
|
virtual bool link_full_duplex() override { return true; }
|
|
virtual int link_speed() override { return 1000; }
|
|
};
|
|
|
|
}
|