diff --git a/src_main/io_devices/piethernet.cpp b/src_main/io_devices/piethernet.cpp index 3526a720..bb93ae45 100755 --- a/src_main/io_devices/piethernet.cpp +++ b/src_main/io_devices/piethernet.cpp @@ -1125,21 +1125,22 @@ PIEthernet::InterfaceList PIEthernet::interfaces() { } delete ifc.ifc_buf; # else - struct ifaddrs * ret; + struct ifaddrs * ret, * cif = 0; int s = ::socket(AF_INET, SOCK_STREAM, IPPROTO_IP); if (getifaddrs(&ret) == 0) { - while (ret != 0) { - if (ret->ifa_addr == 0) { - ret = ret->ifa_next; + cif = ret; + while (cif != 0) { + if (cif->ifa_addr == 0) { + cif = cif->ifa_next; continue; } - if (ret->ifa_addr->sa_family != AF_INET) { - ret = ret->ifa_next; + if (cif->ifa_addr->sa_family != AF_INET) { + cif = cif->ifa_next; continue; } - ci.name = PIString(ret->ifa_name); - ci.address = getSockAddr(ret->ifa_addr); - ci.netmask = getSockAddr(ret->ifa_netmask); + ci.name = PIString(cif->ifa_name); + ci.address = getSockAddr(cif->ifa_addr); + ci.netmask = getSockAddr(cif->ifa_netmask); ci.mac.clear(); # ifdef QNX # ifndef BLACKBERRY @@ -1166,7 +1167,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() { # else if (s != -1) { struct ifreq ir; - strcpy(ir.ifr_name, ret->ifa_name); + strcpy(ir.ifr_name, cif->ifa_name); if (ioctl(s, SIOCGIFHWADDR, &ir) == 0) { ci.mac = macFromBytes(PIByteArray(ir.ifr_hwaddr.sa_data, 6)); ci.mtu = ir.ifr_mtu; @@ -1175,21 +1176,21 @@ PIEthernet::InterfaceList PIEthernet::interfaces() { # endif # endif ci.flags = 0; - if (ret->ifa_flags & IFF_UP) ci.flags |= PIEthernet::ifActive; - if (ret->ifa_flags & IFF_RUNNING) ci.flags |= PIEthernet::ifRunning; - if (ret->ifa_flags & IFF_BROADCAST) ci.flags |= PIEthernet::ifBroadcast; - if (ret->ifa_flags & IFF_MULTICAST) ci.flags |= PIEthernet::ifMulticast; - if (ret->ifa_flags & IFF_LOOPBACK) ci.flags |= PIEthernet::ifLoopback; - if (ret->ifa_flags & IFF_POINTOPOINT) ci.flags |= PIEthernet::ifPTP; + if (cif->ifa_flags & IFF_UP) ci.flags |= PIEthernet::ifActive; + if (cif->ifa_flags & IFF_RUNNING) ci.flags |= PIEthernet::ifRunning; + if (cif->ifa_flags & IFF_BROADCAST) ci.flags |= PIEthernet::ifBroadcast; + if (cif->ifa_flags & IFF_MULTICAST) ci.flags |= PIEthernet::ifMulticast; + if (cif->ifa_flags & IFF_LOOPBACK) ci.flags |= PIEthernet::ifLoopback; + if (cif->ifa_flags & IFF_POINTOPOINT) ci.flags |= PIEthernet::ifPTP; ci.broadcast.clear(); ci.ptp.clear(); if (ci.flags[PIEthernet::ifBroadcast]) - ci.broadcast = getSockAddr(ret->ifa_broadaddr); + ci.broadcast = getSockAddr(cif->ifa_broadaddr); if (ci.flags[PIEthernet::ifPTP]) - ci.ptp = getSockAddr(ret->ifa_dstaddr); - ci.index = if_nametoindex(ret->ifa_name); + ci.ptp = getSockAddr(cif->ifa_dstaddr); + ci.index = if_nametoindex(cif->ifa_name); il << ci; - ret = ret->ifa_next; + cif = cif->ifa_next; } freeifaddrs(ret); } else