mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
241bbce264
Allow this to fail (although we VERIFY that it succeeds during boot for now, since we don't want to boot without a loopback adapter.)
38 lines
777 B
C++
38 lines
777 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/Singleton.h>
|
|
#include <Kernel/Net/LoopbackAdapter.h>
|
|
|
|
namespace Kernel {
|
|
|
|
static bool s_loopback_initialized = false;
|
|
|
|
RefPtr<LoopbackAdapter> LoopbackAdapter::try_create()
|
|
{
|
|
return adopt_ref_if_nonnull(new LoopbackAdapter());
|
|
}
|
|
|
|
LoopbackAdapter::LoopbackAdapter()
|
|
{
|
|
VERIFY(!s_loopback_initialized);
|
|
s_loopback_initialized = true;
|
|
set_loopback_name();
|
|
set_mtu(65536);
|
|
set_mac_address({ 19, 85, 2, 9, 0x55, 0xaa });
|
|
}
|
|
|
|
LoopbackAdapter::~LoopbackAdapter()
|
|
{
|
|
}
|
|
|
|
void LoopbackAdapter::send_raw(ReadonlyBytes payload)
|
|
{
|
|
dbgln("LoopbackAdapter: Sending {} byte(s) to myself.", payload.size());
|
|
did_receive(payload);
|
|
}
|
|
|
|
}
|