fix get mtu

This commit is contained in:
2025-06-24 18:14:23 +03:00
parent f4e8ba0bb7
commit 98764b9ee0

View File

@@ -1243,9 +1243,12 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
# else
if (s != -1) {
struct ifreq ir;
strcpy(ir.ifr_name, cif->ifa_name);
memset(&ir, 0, sizeof(ir));
strncpy(ir.ifr_name, cif->ifa_name, sizeof(ir.ifr_name));
if (ioctl(s, SIOCGIFHWADDR, &ir) == 0) {
ci.mac = macFromBytes(PIByteArray(ir.ifr_hwaddr.sa_data, 6));
}
if (ioctl(s, SIOCGIFMTU, &ir) == 0) {
ci.mtu = ir.ifr_mtu;
}
}