From 2235ffe2f754da543b796446377b1419bf046204 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 16 Dec 2007 02:39:01 +0100 Subject: r26467: Use getifaddrs() for interface enumeration and provide replacements for platforms that don't have it in lib/replace. (lib/replace part of 9b4924fbd8619033c55b4c6e2589da247332e7db - Michael) (This used to be commit 789bf2d36bd728cc68b58cfb1e9570b90ca09af7) --- source3/lib/replace/system/network.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index aff8a841da..61be51744c 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -6,6 +6,7 @@ networking system include wrappers Copyright (C) Andrew Tridgell 2004 + Copyright (C) Jelmer Vernooij 2007 ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released @@ -97,6 +98,30 @@ int rep_inet_pton(int af, const char *src, void *dst); const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif +#ifdef HAVE_IFADDRS_H +#include +#endif + +#ifndef HAVE_STRUCT_IFADDRS +struct ifaddrs { + struct ifaddrs *ifa_next; /* Pointer to next struct */ + char *ifa_name; /* Interface name */ + u_int ifa_flags; /* Interface flags */ + struct sockaddr *ifa_addr; /* Interface address */ + struct sockaddr *ifa_netmask; /* Interface netmask */ + struct sockaddr *ifa_dstaddr; /* P2P interface destination */ + void *ifa_data; /* Address specific data */ +}; +#endif + +#ifndef HAVE_GETIFADDRS +int rep_getifaddrs(struct ifaddrs **); +#endif + +#ifndef HAVE_FREEIFADDRS +int rep_freeifaddrs(struct ifaddrs **); +#endif + /* * Some systems have getaddrinfo but not the * defines needed to use it. -- cgit From 7728a23d43a79eefaf2cc7e1998283e3d1e095f8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 16 Dec 2007 03:22:13 +0100 Subject: r26469: Fix paths, only include IPv4 addresses for now. (cherry picked from commit fa9e3b6fa871b7541878f836ea54e882e614a3cf) (This used to be commit a2d6f6b4ae7fb6711d4228b9e255eebb6bf344bd) --- source3/lib/replace/system/network.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index 61be51744c..0b5fbcddd1 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -106,7 +106,7 @@ const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); 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 */ -- cgit From ea9ce8f9ac44867403673012cd0979f21cf50a27 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 17 Dec 2007 06:57:30 +0100 Subject: r26492: Some hosts have a define called ifa_dstaddr. (cherry picked from commit c4cd935ee783b2f4939e2c481bbdb1bbdb9190cd) (This used to be commit 839d128a42aa624e3cd978700059f947022ee733) --- source3/lib/replace/system/network.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index 0b5fbcddd1..e03c991b3c 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -109,6 +109,7 @@ struct ifaddrs { unsigned int ifa_flags; /* Interface flags */ struct sockaddr *ifa_addr; /* Interface address */ struct sockaddr *ifa_netmask; /* Interface netmask */ +#undef ifa_dstaddr struct sockaddr *ifa_dstaddr; /* P2P interface destination */ void *ifa_data; /* Address specific data */ }; -- cgit From f822f4150b2b04619d68686ffdb72e82310a7175 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 17 Dec 2007 08:20:29 +0100 Subject: r26497: Fix return type for freeifaddrs(). (cherry picked from commit 8c65053f51330bb55a81572264eefbcc56029dc1) (This used to be commit 57587e49f5942b81508b40e3c9a67e7536f2271d) --- source3/lib/replace/system/network.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index e03c991b3c..fa5ec9a680 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -120,7 +120,7 @@ int rep_getifaddrs(struct ifaddrs **); #endif #ifndef HAVE_FREEIFADDRS -int rep_freeifaddrs(struct ifaddrs **); +void rep_freeifaddrs(struct ifaddrs **); #endif /* -- cgit From f75d7a69927960ddcc81a31084b1cc11d96838ff Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 17 Dec 2007 12:27:59 +0100 Subject: r26507: Fix function signature for freeifaddrs. (cherry picked from commit cc873bdd2e86e5b380c3056810ccc5ad98372f7c) (This used to be commit ccfb04d18516e0aca88ea0a96afe119175bddba7) --- source3/lib/replace/system/network.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index fa5ec9a680..d09e3f71f8 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -120,7 +120,7 @@ int rep_getifaddrs(struct ifaddrs **); #endif #ifndef HAVE_FREEIFADDRS -void rep_freeifaddrs(struct ifaddrs **); +void rep_freeifaddrs(struct ifaddrs *); #endif /* -- cgit From 9ba696cb68a9c16bc2d55ac07df0b1ee626d6261 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 20 Feb 2008 12:49:30 +0100 Subject: libreplace: change samba_cv_ to libreplace_cv_ in system/config.m4. Michael (cherry picked from commit 00c173bfba9c659750bf231fbd9278dd38aa8bfc) (This used to be commit 450034582ba78b296e9cacc9ea06b632196b8644) --- source3/lib/replace/system/config.m4 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/config.m4 b/source3/lib/replace/system/config.m4 index 1c05733126..66c2bd652a 100644 --- a/source3/lib/replace/system/config.m4 +++ b/source3/lib/replace/system/config.m4 @@ -18,7 +18,7 @@ AC_CHECK_HEADERS(sys/capability.h) case "$host_os" in *linux*) -AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ +AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ AC_TRY_COMPILE([ #ifdef HAVE_SYS_VFS_H #include @@ -29,14 +29,14 @@ AC_TRY_COMPILE([ ],[ int i; ], - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no, - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes + libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no, + libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes )]) -if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then +if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files]) fi -AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[ +AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[ AC_TRY_COMPILE([ #ifdef HAVE_SYS_CAPABILITY_H #include @@ -45,10 +45,10 @@ AC_TRY_COMPILE([ ],[ __s8 i; ], - samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no, - samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes + libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no, + libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes )]) -if test x"$samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then +if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h]) fi ;; -- cgit From 9f5c463415b8b7ea495589ce3fa9deb7c01efb2e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 26 Feb 2008 11:18:51 +0100 Subject: Fix build on VOS: socklen_t is needed for rep_inet_ntop: move it up. Michael (This used to be commit 7b98620ef16c6969fd21dd9c157aedd4adb117a3) --- source3/lib/replace/system/network.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index d09e3f71f8..a84b22e5d0 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -83,6 +83,11 @@ #include #endif +#ifndef HAVE_SOCKLEN_T +#define HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + #ifdef REPLACE_INET_NTOA /* define is in "replace.h" */ char *rep_inet_ntoa(struct in_addr ip); @@ -245,11 +250,6 @@ void rep_freeifaddrs(struct ifaddrs *); #define HOST_NAME_MAX 256 #endif -#ifndef HAVE_SOCKLEN_T -#define HAVE_SOCKLEN_T -typedef int socklen_t; -#endif - #ifndef HAVE_SA_FAMILY_T #define HAVE_SA_FAMILY_T typedef unsigned short int sa_family_t; -- cgit From 7bdd648477c49dc7e23f832b2438bef673398fbf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 26 Feb 2008 13:24:54 +0100 Subject: libreplace: Add tests for connect and gethostbyname. Provide dummy replacements when a function isnt found. The functions are also searched for in certain libraries, and variables SOCKET_LIBS and NSL_LIBS are set accordingly. One purpose of this is to fix the getifaddrs tests on systems where e.g. the socket calls require special libs for linking. Michael (This used to be commit c19f7a0e1004213f95e0bf8db5cd1f6697c7a47b) --- source3/lib/replace/system/network.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index a84b22e5d0..410c6d7cca 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -103,6 +103,16 @@ int rep_inet_pton(int af, const char *src, void *dst); const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif +#ifndef HAVE_CONNECT +/* define is in "replace.h" */ +int rep_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +#endif + +#ifndef HAVE_GETHOSTBYNAME +/* define is in "replace.h" */ +struct hostent *rep_gethostbyname(const char *name); +#endif + #ifdef HAVE_IFADDRS_H #include #endif -- cgit From 8f58ae97f0c46dc66f680d7b6ed93ee2aa6bc629 Mon Sep 17 00:00:00 2001 From: "Gerald W. Carter" Date: Thu, 28 Feb 2008 11:58:05 -0600 Subject: Fix macro name (no 's' in ifr_addr). Interface detection on Solaris still failing due to items pointed out here: http://lists.samba.org/archive/samba-technical/2007-November/056701.html (This used to be commit 37c87acc9d48c1fb5d4806374ca8e992300db1ff) --- source3/lib/replace/system/network.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/replace/system') diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index 410c6d7cca..796df2d1da 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -305,7 +305,7 @@ struct addrinfo { /* Needed for some systems that don't define it (Solaris). */ #ifndef ifr_netmask -#define ifr_netmask ifr_addrs +#define ifr_netmask ifr_addr #endif #ifdef SOCKET_WRAPPER -- cgit