svn commit: samba r18687 - in branches/SAMBA_3_0/source: . lib

metze at samba.org metze at samba.org
Tue Sep 19 21:58:00 GMT 2006


Author: metze
Date: 2006-09-19 21:57:59 +0000 (Tue, 19 Sep 2006)
New Revision: 18687

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18687

Log:
sync the lib/interfaces.c with lib/socket/netif.c from samba4
to hopefully fix the build on HPUX and Tru64

metze

Modified:
   branches/SAMBA_3_0/source/configure.in
   branches/SAMBA_3_0/source/lib/interfaces.c


Changeset:
Modified: branches/SAMBA_3_0/source/configure.in
===================================================================
--- branches/SAMBA_3_0/source/configure.in	2006-09-19 21:41:02 UTC (rev 18686)
+++ branches/SAMBA_3_0/source/configure.in	2006-09-19 21:57:59 UTC (rev 18687)
@@ -2757,24 +2757,29 @@
 # look for a method of finding the list of network interfaces
 iface=no;
 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
 AC_TRY_RUN([
 #define HAVE_IFACE_AIX 1
 #define AUTOCONF_TEST 1
-#include "confdefs.h"
+#undef _XOPEN_SOURCE_EXTENDED
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
+CPPFLAGS="$SAVE_CPPFLAGS"
 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
     iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
 fi
 
 if test $iface = no; then
 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
 AC_TRY_RUN([
 #define HAVE_IFACE_IFCONF 1
 #define AUTOCONF_TEST 1
-#include "confdefs.h"
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
+CPPFLAGS="$SAVE_CPPFLAGS"
 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
 fi
@@ -2782,12 +2787,14 @@
 
 if test $iface = no; then
 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
 AC_TRY_RUN([
 #define HAVE_IFACE_IFREQ 1
 #define AUTOCONF_TEST 1
-#include "confdefs.h"
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
+CPPFLAGS="$SAVE_CPPFLAGS"
 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
 fi

Modified: branches/SAMBA_3_0/source/lib/interfaces.c
===================================================================
--- branches/SAMBA_3_0/source/lib/interfaces.c	2006-09-19 21:41:02 UTC (rev 18686)
+++ branches/SAMBA_3_0/source/lib/interfaces.c	2006-09-19 21:57:59 UTC (rev 18687)
@@ -30,28 +30,22 @@
 
 */
 
+#ifndef AUTOCONF_TEST
+#include "config.h"
+#endif
+
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/types.h>
+#include <netdb.h>
+#include <sys/ioctl.h>
+#include <netdb.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <netdb.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <net/if.h>
 
-#ifdef AUTOCONF_TEST
-struct iface_struct {
-	char name[16];
-	struct in_addr ip;
-	struct in_addr netmask;
-};
-#else
-#include "config.h"
-#include "interfaces.h"
-#endif
-
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -82,6 +76,12 @@
 #define QSORT_CAST (int (*)(const void *, const void *))
 #endif
 
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
+#include "interfaces.h"
+
 #if HAVE_IFACE_IFCONF
 
 /* this works for Linux 2.2, Solaris 2.5, SunOS4, HPUX 10.20, OSF1
@@ -154,7 +154,9 @@
 	return total;
 }  
 
-#elif HAVE_IFACE_IFREQ
+#define _FOUND_IFACE_ANY
+#endif /* HAVE_IFACE_IFCONF */
+#ifdef HAVE_IFACE_IFREQ
 
 #ifndef I_STR
 #include <sys/stropts.h>
@@ -249,7 +251,9 @@
 	return total;
 }
 
-#elif HAVE_IFACE_AIX
+#define _FOUND_IFACE_ANY
+#endif /* HAVE_IFACE_IFREQ */
+#ifdef HAVE_IFACE_AIX
 
 /****************************************************************************
 this one is for AIX (tested on 4.2)
@@ -284,7 +288,7 @@
 	i = ifc.ifc_len;
 
 	while (i > 0 && total < max_interfaces) {
-		unsigned inc;
+		uint_t inc;
 
 		inc = ifr->ifr_addr.sa_len;
 
@@ -337,7 +341,9 @@
 	return total;
 }
 
-#else /* a dummy version */
+#define _FOUND_IFACE_ANY
+#endif /* HAVE_IFACE_AIX */
+#ifndef _FOUND_IFACE_ANY
 static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
 {
 	return -1;
@@ -358,8 +364,6 @@
 
 /* this wrapper is used to remove duplicates from the interface list generated
    above */
-int get_interfaces(struct iface_struct *ifaces, int max_interfaces);
-
 int get_interfaces(struct iface_struct *ifaces, int max_interfaces)
 {
 	int total, i, j;
@@ -388,8 +392,6 @@
 #ifdef AUTOCONF_TEST
 /* this is the autoconf driver to test get_interfaces() */
 
-#define MAX_INTERFACES 128
-
  int main()
 {
 	struct iface_struct ifaces[MAX_INTERFACES];



More information about the samba-cvs mailing list