92f673c891
based on suggestion and patches from millert@
99 lines
2.3 KiB
Plaintext
99 lines
2.3 KiB
Plaintext
$OpenBSD: patch-ntpd_ntp_io_c,v 1.1 2002/05/11 20:58:14 danh Exp $
|
|
--- ntpd/ntp_io.c.orig Mon May 6 14:01:35 2002
|
|
+++ ntpd/ntp_io.c Mon May 6 14:26:53 2002
|
|
@@ -41,7 +41,7 @@
|
|
#endif
|
|
#include <arpa/inet.h>
|
|
|
|
-#if _BSDI_VERSION >= 199510
|
|
+#if HAVE_GETIFADDRS
|
|
# include <ifaddrs.h>
|
|
#endif
|
|
|
|
@@ -204,15 +204,15 @@ create_sockets(
|
|
u_int port
|
|
)
|
|
{
|
|
-#if _BSDI_VERSION >= 199510
|
|
+#if HAVE_GETIFADDRS
|
|
int i, j;
|
|
struct ifaddrs *ifaddrs, *ifap;
|
|
struct sockaddr_in resmask;
|
|
-#if _BSDI_VERSION < 199701
|
|
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
|
|
struct ifaddrs *lp;
|
|
int num_if;
|
|
#endif
|
|
-#else /* _BSDI_VERSION >= 199510 */
|
|
+#else /* HAVE_GETIFADDRS */
|
|
# ifdef STREAMS_TLI
|
|
struct strioctl ioc;
|
|
# endif /* STREAMS_TLI */
|
|
@@ -221,7 +221,7 @@ create_sockets(
|
|
struct ifreq ifreq, *ifr;
|
|
int n, i, j, vs, size = 0;
|
|
struct sockaddr_in resmask;
|
|
-#endif /* _BSDI_VERSION >= 199510 */
|
|
+#endif /* HAVE_GETIFADDRS */
|
|
|
|
#ifdef DEBUG
|
|
if (debug)
|
|
@@ -243,8 +243,18 @@ create_sockets(
|
|
inter_list[0].flags = INT_BROADCAST;
|
|
any_interface = &inter_list[0];
|
|
|
|
-#if _BSDI_VERSION >= 199510
|
|
-#if _BSDI_VERSION >= 199701
|
|
+#if HAVE_GETIFADDRS
|
|
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
|
|
+ if (getifaddrs(&ifaddrs, &num_if) < 0)
|
|
+ {
|
|
+ msyslog(LOG_ERR, "create_sockets: getifaddrs() failed: %m");
|
|
+ exit(1);
|
|
+ }
|
|
+
|
|
+ i = 1;
|
|
+
|
|
+ for (ifap = ifaddrs, lp = ifap + num_if; ifap < lp; ifap++)
|
|
+#else
|
|
if (getifaddrs(&ifaddrs) < 0)
|
|
{
|
|
msyslog(LOG_ERR, "getifaddrs: %m");
|
|
@@ -252,17 +262,7 @@ create_sockets(
|
|
}
|
|
i = 1;
|
|
for (ifap = ifaddrs; ifap != NULL; ifap = ifap->ifa_next)
|
|
-#else
|
|
- if (getifaddrs(&ifaddrs, &num_if) < 0)
|
|
- {
|
|
- msyslog(LOG_ERR, "create_sockets: getifaddrs() failed: %m");
|
|
- exit(1);
|
|
- }
|
|
-
|
|
- i = 1;
|
|
-
|
|
- for (ifap = ifaddrs, lp = ifap + num_if; ifap < lp; ifap++)
|
|
-#endif
|
|
+#endif /* _BSDI_VERSION */
|
|
{
|
|
struct sockaddr_in *sin;
|
|
|
|
@@ -333,7 +333,7 @@ create_sockets(
|
|
break;
|
|
}
|
|
free(ifaddrs);
|
|
-#else /* _BSDI_VERSION >= 199510 */
|
|
+#else /* HAVE_GETIFADDRS */
|
|
# ifdef USE_STREAMS_DEVICE_FOR_IF_CONFIG
|
|
if ((vs = open("/dev/ip", O_RDONLY)) < 0)
|
|
{
|
|
@@ -595,7 +595,7 @@ create_sockets(
|
|
break;
|
|
}
|
|
closesocket(vs);
|
|
-#endif /* _BSDI_VERSION >= 199510 */
|
|
+#endif /* HAVE_GETIFADDRS */
|
|
|
|
ninterfaces = i;
|
|
maxactivefd = 0;
|