mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +00:00
Userland: Set the mask of a network adapter with ifconfig (#1388)
A new IP address or a new network mask can be specified in the command line arguments of ifconfig to replace the old values of a given network adapter. Additionally, more information is being printed for each adapter.
This commit is contained in:
committed by
GitHub
parent
4c9bb266df
commit
8cf962a102
@@ -485,6 +485,14 @@ int IPv4Socket::ioctl(FileDescription&, unsigned request, unsigned arg)
|
||||
adapter->set_ipv4_address(IPv4Address(((sockaddr_in&)ifr->ifr_addr).sin_addr.s_addr));
|
||||
return 0;
|
||||
|
||||
case SIOCSIFNETMASK:
|
||||
if (!Process::current->is_superuser())
|
||||
return -EPERM;
|
||||
if (ifr->ifr_addr.sa_family != AF_INET)
|
||||
return -EAFNOSUPPORT;
|
||||
adapter->set_ipv4_netmask(IPv4Address(((sockaddr_in&)ifr->ifr_netmask).sin_addr.s_addr));
|
||||
return 0;
|
||||
|
||||
case SIOCGIFADDR:
|
||||
if (!Process::current->validate_write_typed(ifr))
|
||||
return -EFAULT;
|
||||
|
||||
Reference in New Issue
Block a user