mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:55:08 +00:00
IPv4: Implement socket ioctls SIOCGIFADDR and SIOCSIFADDR
This allows userspace programs to get and set (superuser-only) the IPv4 address of a network adapter. :^)
This commit is contained in:
parent
a3575f3c60
commit
2482fc3538
7 changed files with 117 additions and 1 deletions
|
@ -32,6 +32,16 @@ WeakPtr<NetworkAdapter> NetworkAdapter::from_ipv4_address(const IPv4Address& add
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
WeakPtr<NetworkAdapter> NetworkAdapter::lookup_by_name(const StringView& name)
|
||||
{
|
||||
NetworkAdapter* found_adapter = nullptr;
|
||||
for_each([&](auto& adapter) {
|
||||
if (adapter.name() == name)
|
||||
found_adapter = &adapter;
|
||||
});
|
||||
return found_adapter ? found_adapter->make_weak_ptr() : nullptr;
|
||||
}
|
||||
|
||||
NetworkAdapter::NetworkAdapter()
|
||||
{
|
||||
// FIXME: I wanna lock :(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue