diff --git a/sysdeps/managarm/generic/ioctl.cpp b/sysdeps/managarm/generic/ioctl.cpp index c0e367c472..c964b754a9 100644 --- a/sysdeps/managarm/generic/ioctl.cpp +++ b/sysdeps/managarm/generic/ioctl.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -873,6 +874,34 @@ int sys_ioctl(int fd, unsigned long request, void *arg, int *result) { ifr->ifr_mtu = resp.mtu(); + return 0; + }); + }else if(request == SIOCGIFBRDADDR) { + return handle_siocgif([](auto req, auto ifr) { + req.set_name(frg::string{ifr->ifr_name, getSysdepsAllocator()}); + }, [](auto resp, auto ifr) { + if(resp.error() != managarm::fs::Errors::SUCCESS) + return EINVAL; + + sockaddr_in addr{}; + addr.sin_family = AF_INET; + addr.sin_addr = { htonl(resp.ip4_broadcast_addr()) }; + memcpy(&ifr->ifr_broadaddr, &addr, sizeof(addr)); + + return 0; + }); + } else if(request == SIOCGIFHWADDR) { + return handle_siocgif([](auto req, auto ifr) { + req.set_name(frg::string{ifr->ifr_name, getSysdepsAllocator()}); + }, [](auto resp, auto ifr) { + if(resp.error() != managarm::fs::Errors::SUCCESS) + return EINVAL; + + sockaddr addr{}; + addr.sa_family = ARPHRD_ETHER; + memcpy(addr.sa_data, resp.mac().data(), 6); + memcpy(&ifr->ifr_hwaddr, &addr, sizeof(addr)); + return 0; }); }