svn commit: samba r26469 - in branches/SAMBA_4_0: . source/lib/replace source/lib/replace/system

jelmer at samba.org jelmer at samba.org
Sun Dec 16 03:22:14 GMT 2007


Author: jelmer
Date: 2007-12-16 03:22:13 +0000 (Sun, 16 Dec 2007)
New Revision: 26469

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

Log:
Fix paths, only include IPv4 addresses for now.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/replace/getifaddrs.c
   branches/SAMBA_4_0/source/lib/replace/getifaddrs.m4
   branches/SAMBA_4_0/source/lib/replace/system/network.h


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/replace/getifaddrs.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/getifaddrs.c	2007-12-16 02:49:52 UTC (rev 26468)
+++ branches/SAMBA_4_0/source/lib/replace/getifaddrs.c	2007-12-16 03:22:13 UTC (rev 26469)
@@ -360,20 +360,25 @@
 
  int main()
 {
-	struct ifaddrs *ifs;
-	int total = get_interfaces(ifaces, MAX_INTERFACES);
-	int i;
-
-	int ret = getifaddrs(&ifs);
+	struct ifaddrs *ifs = NULL;
+	int ret;
+	
+	ret = getifaddrs(&ifs);
 	if (ret != 0) {
 		perror("getifaddrs() failed");
 		return 1;
 	}
 
 	while (ifs) {
-		printf("%-10s ", ifs->ifr_name);
-		printf("IP=%s ", inet_ntoa(((struct sockaddr_in *)ifs->ifr_addr)->sin_addr));
-		printf("NETMASK=%s\n", inet_ntoa(((struct sockaddr_in *)ifs->ifr_netmask)->sin_addr));
+		printf("%-10s ", ifs->ifa_name);
+		if (ifs->ifa_addr != NULL && 
+		    ifs->ifa_addr->sa_family == AF_INET) {
+			printf("IP=%s ", inet_ntoa(((struct sockaddr_in *)ifs->ifa_addr)->sin_addr));
+			if (ifs->ifa_netmask != NULL)
+				printf("NETMASK=%s", inet_ntoa(((struct sockaddr_in *)ifs->ifa_netmask)->sin_addr));
+		}
+		printf("\n");
+		ifs = ifs->ifa_next;
 	}
 	return 0;
 }

Modified: branches/SAMBA_4_0/source/lib/replace/getifaddrs.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/getifaddrs.m4	2007-12-16 02:49:52 UTC (rev 26468)
+++ branches/SAMBA_4_0/source/lib/replace/getifaddrs.m4	2007-12-16 03:22:13 UTC (rev 26469)
@@ -26,10 +26,8 @@
 #
 # This tests need LIBS="$NSL_LIBS $SOCKET_LIBS"
 #
-old_CFLAGS=$CFLAGS
 old_LIBS=$LIBS
 LIBS="$NSL_LIBS $SOCKET_LIBS"
-CFLAGS="$CFLAGS -Ilib/replace"
 iface=no;
 ##################
 # look for a method of finding the list of network interfaces
@@ -41,8 +39,8 @@
 #define NO_CONFIG_H 1
 #define HAVE_IFACE_GETIFADDRS 1
 #define AUTOCONF_TEST 1
-#include "${srcdir-.}/lib/replace/replace.c"
-#include "${srcdir-.}/lib/replace/getifaddrs.c"],
+#include "$libreplacedir/replace.c"
+#include "$libreplacedir/getifaddrs.c"],
            samba_cv_HAVE_IFACE_GETIFADDRS=yes,samba_cv_HAVE_IFACE_GETIFADDRS=no,samba_cv_HAVE_IFACE_GETIFADDRS=cross)])
 CPPFLAGS="$SAVE_CPPFLAGS"
 if test x"$samba_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
@@ -58,7 +56,7 @@
 #define HAVE_IFACE_AIX 1
 #define AUTOCONF_TEST 1
 #undef _XOPEN_SOURCE_EXTENDED
-#include "${srcdir-.}/lib/replace/getifaddrs.c"],
+#include "$libreplacedir/getifaddrs.c"],
            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
     iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
@@ -71,7 +69,7 @@
 AC_TRY_RUN([
 #define HAVE_IFACE_IFCONF 1
 #define AUTOCONF_TEST 1
-#include "${srcdir-.}/lib/replace/getifaddrs.c"],
+#include "$libreplacedir/getifaddrs.c"],
            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
@@ -83,12 +81,11 @@
 AC_TRY_RUN([
 #define HAVE_IFACE_IFREQ 1
 #define AUTOCONF_TEST 1
-#include "${srcdir-.}/lib/replace/getifaddrs.c"],
+#include "$libreplacedir/getifaddrs.c"],
            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
 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
 fi
 
-CFLAGS=$old_CFLAGS
 LIBS=$old_LIBS

Modified: branches/SAMBA_4_0/source/lib/replace/system/network.h
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/system/network.h	2007-12-16 02:49:52 UTC (rev 26468)
+++ branches/SAMBA_4_0/source/lib/replace/system/network.h	2007-12-16 03:22:13 UTC (rev 26469)
@@ -102,7 +102,7 @@
 struct ifaddrs {
 	struct ifaddrs   *ifa_next;         /* Pointer to next struct */
 	char             *ifa_name;         /* Interface name */
-	u_int             ifa_flags;        /* Interface flags */
+	unsigned int     ifa_flags;         /* Interface flags */
 	struct sockaddr  *ifa_addr;         /* Interface address */
 	struct sockaddr  *ifa_netmask;      /* Interface netmask */
 	struct sockaddr  *ifa_dstaddr;      /* P2P interface destination */



More information about the samba-cvs mailing list