$OpenBSD: patch-src_ptlib_unix_socket_cxx,v 1.2 2011/10/26 16:59:09 ajacoutot Exp $ --- src/ptlib/unix/socket.cxx.orig Fri Oct 14 08:54:51 2011 +++ src/ptlib/unix/socket.cxx Sat Oct 22 12:41:24 2011 @@ -69,7 +69,7 @@ #include #endif -#if defined(P_NETBSD) +#if defined(P_NETBSD) || defined(P_OPENBSD) #include #endif @@ -484,9 +484,11 @@ PBoolean PIPSocket::IsLocalHost(const PString & hostna PUDPSocket sock; PBYTEArray buffer; +#if !defined(P_NETBSD) && !defined(P_OPENBSD) struct ifconf ifConf; +#endif -#if defined(P_NETBSD) +#if defined(P_NETBSD) || defined(P_OPENBSD) struct ifaddrs *ifap, *ifa; PAssert(getifaddrs(&ifap) == 0, "getifaddrs failed"); @@ -509,7 +511,7 @@ PBoolean PIPSocket::IsLocalHost(const PString & hostna while (ifName < ifEndList) { #endif struct ifreq ifReq; -#if !defined(P_NETBSD) +#if !defined(P_NETBSD) && !defined(P_OPENBSD) memcpy(&ifReq, ifName, sizeof(ifreq)); #else memset(&ifReq, 0, sizeof(ifReq)); @@ -526,14 +528,14 @@ PBoolean PIPSocket::IsLocalHost(const PString & hostna } } -#if defined(P_FREEBSD) || defined(P_OPENBSD) || defined(P_MACOSX) || defined(P_VXWORKS) || defined(P_RTEMS) || defined(P_QNX) +#if defined(P_FREEBSD) || defined(P_MACOSX) || defined(P_VXWORKS) || defined(P_RTEMS) || defined(P_QNX) // move the ifName pointer along to the next ifreq entry ifName = (struct ifreq *)((char *)ifName + _SIZEOF_ADDR_IFREQ(*ifName)); -#elif !defined(P_NETBSD) +#elif !defined(P_NETBSD) && !defined(P_OPENBSD) ifName++; #endif } -#if !defined(P_NETBSD) +#if !defined(P_NETBSD) && !defined(P_OPENBSD) } #endif @@ -1875,9 +1877,11 @@ PBoolean PIPSocket::GetInterfaceTable(InterfaceTable & PUDPSocket sock; PBYTEArray buffer; +#if !defined(P_NETBSD) && !defined(P_OPENBSD) struct ifconf ifConf; +#endif -#if defined(P_NETBSD) +#if defined(P_NETBSD) || defined(P_OPENBSD) struct ifaddrs *ifap, *ifa; PAssert(getifaddrs(&ifap) == 0, "getifaddrs failed"); @@ -1901,7 +1905,7 @@ PBoolean PIPSocket::GetInterfaceTable(InterfaceTable & while (ifName < ifEndList) { #endif struct ifreq ifReq; -#if !defined(P_NETBSD) +#if !defined(P_NETBSD) && !defined(P_OPENBSD) memcpy(&ifReq, ifName, sizeof(ifreq)); #else memset(&ifReq, 0, sizeof(ifReq)); @@ -1920,7 +1924,7 @@ PBoolean PIPSocket::GetInterfaceTable(InterfaceTable & macAddr = PEthSocket::Address((BYTE *)ifReq.ifr_macaddr); #endif -#if !defined(P_NETBSD) +#if !defined(P_NETBSD) && !defined(P_OPENBSD) memcpy(&ifReq, ifName, sizeof(ifreq)); #else memset(&ifReq, 0, sizeof(ifReq)); @@ -1932,7 +1936,7 @@ PBoolean PIPSocket::GetInterfaceTable(InterfaceTable & sockaddr_in * sin = (sockaddr_in *)&ifReq.ifr_addr; PIPSocket::Address addr = sin->sin_addr; -#if !defined(P_NETBSD) +#if !defined(P_NETBSD) && !defined(P_OPENBSD) memcpy(&ifReq, ifName, sizeof(ifreq)); #else memset(&ifReq, 0, sizeof(ifReq)); @@ -1966,15 +1970,15 @@ PBoolean PIPSocket::GetInterfaceTable(InterfaceTable & } } -#if defined(P_FREEBSD) || defined(P_OPENBSD) || defined(P_MACOSX) || defined(P_VXWORKS) || defined(P_RTEMS) || defined(P_QNX) +#if defined(P_FREEBSD) || defined(P_MACOSX) || defined(P_VXWORKS) || defined(P_RTEMS) || defined(P_QNX) // move the ifName pointer along to the next ifreq entry ifName = (struct ifreq *)((char *)ifName + _SIZEOF_ADDR_IFREQ(*ifName)); -#elif !defined(P_NETBSD) +#elif !defined(P_NETBSD) && !defined(P_OPENBSD) ifName++; #endif } -#if !defined(P_NETBSD) +#if !defined(P_NETBSD) && !defined(P_OPENBSD) } #endif