use getifaddrs/freeifaddrs if available
based on suggestion and patches from millert@
This commit is contained in:
parent
802de08c33
commit
92f673c891
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.19 2001/12/20 21:07:21 danh Exp $
|
||||
# $OpenBSD: Makefile,v 1.20 2002/05/11 20:58:14 danh Exp $
|
||||
|
||||
COMMENT= "network time protocol implementation"
|
||||
COMMENT-doc= "network time protocol documentation"
|
||||
@ -26,9 +26,10 @@ MULTI_PACKAGES= -doc
|
||||
SUBPACKAGE?=
|
||||
|
||||
SEPARATE_BUILD= concurrent
|
||||
CONFIGURE_STYLE= gnu
|
||||
AUTOCONF_NEW= Yes
|
||||
CONFIGURE_STYLE= autoconf
|
||||
CONFIGURE_ARGS+= --bindir='${PREFIX}/sbin' \
|
||||
--enable-accurate-adjtime --disable-IRIG \
|
||||
--enable-accurate-adjtime --disable-IRIG \
|
||||
--with-openssl-libdir=/usr/lib \
|
||||
--with-openssl-incdir=/usr/include \
|
||||
--with-crypto=openssl
|
||||
|
23
net/ntp/patches/patch-config_h_in
Normal file
23
net/ntp/patches/patch-config_h_in
Normal file
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-config_h_in,v 1.1 2002/05/11 20:58:14 danh Exp $
|
||||
--- config.h.in.orig Mon May 6 15:14:16 2002
|
||||
+++ config.h.in Mon May 6 15:14:50 2002
|
||||
@@ -512,6 +512,9 @@
|
||||
/* Define if you have the `finite' function. */
|
||||
#undef HAVE_FINITE
|
||||
|
||||
+/* Define if you have the `freeifaddrs' function. */
|
||||
+#undef HAVE_FREEIFADDRS
|
||||
+
|
||||
/* Define if you have the `getbootfile' function. */
|
||||
#undef HAVE_GETBOOTFILE
|
||||
|
||||
@@ -520,6 +523,9 @@
|
||||
|
||||
/* Define if you have the `getdtablesize' function. */
|
||||
#undef HAVE_GETDTABLESIZE
|
||||
+
|
||||
+/* Define if you have the `getifaddrs' function. */
|
||||
+#undef HAVE_GETIFADDRS
|
||||
|
||||
/* Define if you have the `getrusage' function. */
|
||||
#undef HAVE_GETRUSAGE
|
@ -1,31 +0,0 @@
|
||||
$OpenBSD: patch-configure,v 1.5 2001/12/20 06:14:16 danh Exp $
|
||||
--- configure.orig Wed Sep 19 02:09:06 2001
|
||||
+++ configure Wed Dec 19 21:16:23 2001
|
||||
@@ -3691,7 +3691,7 @@ if test "${ac_cv_lib_readline_readline+s
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
-LIBS="-lreadline $LIBS"
|
||||
+LIBS="-lreadline -ltermcap $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line 3696 "configure"
|
||||
#include "confdefs.h"
|
||||
@@ -3739,7 +3739,7 @@ if test $ac_cv_lib_readline_readline = y
|
||||
#define HAVE_LIBREADLINE 1
|
||||
EOF
|
||||
|
||||
- LIBS="-lreadline $LIBS"
|
||||
+ LIBS="-lreadline -ltermcap $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
@@ -9056,6 +9056,9 @@ fi
|
||||
done
|
||||
|
||||
case "$target" in
|
||||
+ i386-*-openbsd*)
|
||||
+ # mlockall broken
|
||||
+ ;;
|
||||
*-*-aix4*)
|
||||
# Just a stub. Idiots.
|
||||
;;
|
31
net/ntp/patches/patch-configure_in
Normal file
31
net/ntp/patches/patch-configure_in
Normal file
@ -0,0 +1,31 @@
|
||||
$OpenBSD: patch-configure_in,v 1.1 2002/05/11 20:58:14 danh Exp $
|
||||
--- configure.in.orig Tue Dec 18 21:00:59 2001
|
||||
+++ configure.in Mon May 6 15:07:08 2002
|
||||
@@ -190,10 +190,16 @@ AC_CHECK_LIB(kvm, main) dnl We already
|
||||
AC_CHECK_LIB(ld, nlist)
|
||||
AC_CHECK_LIB(mld, nlist)
|
||||
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent, , , -lsocket))
|
||||
+AC_CHECK_FUNCS(getifaddrs freeifaddrs)
|
||||
AC_CHECK_FUNC(openlog, ,
|
||||
AC_CHECK_LIB(gen, openlog, ,
|
||||
AC_CHECK_LIB(syslog, openlog, , , -lsocket)))
|
||||
-AC_CHECK_LIB(readline, readline)
|
||||
+AC_CHECK_LIB(readline, readline, [cat >>confdefs.h <<EOF
|
||||
+#define HAVE_LIBREADLINE 1
|
||||
+EOF
|
||||
+
|
||||
+ LIBS="-lreadline -ltermcap $LIBS"
|
||||
+], , -ltermcap)
|
||||
|
||||
dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
|
||||
dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,
|
||||
@@ -608,6 +614,9 @@ case "$target" in
|
||||
esac
|
||||
AC_REPLACE_FUNCS(mktime)
|
||||
case "$target" in
|
||||
+ i386-*-openbsd*)
|
||||
+ # mlockall broken
|
||||
+ ;;
|
||||
*-*-aix4*)
|
||||
# Just a stub. Idiots.
|
||||
;;
|
98
net/ntp/patches/patch-ntpd_ntp_io_c
Normal file
98
net/ntp/patches/patch-ntpd_ntp_io_c
Normal file
@ -0,0 +1,98 @@
|
||||
$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;
|
Loading…
Reference in New Issue
Block a user