diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-12-10 16:24:13 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-12-10 16:24:13 +0000 |
commit | 5ea6279dca9679f429c1031ca52cb1f11b9731ce (patch) | |
tree | e3ae57f54c4101381b945ee1ea332112d45f6de9 | |
parent | 3f56f113018416a00676e0b8beb45bdeade351c7 (diff) |
Portability issue on OpenSolaris.
Also detect the required structure element, because OpenSolaris defines
SIOCGIFHWADDR, but without support for IP sockets.
(closes issue #18442)
Reported by: ranjtech
Patches:
20101209__issue18442.diff.txt uploaded by tilghman (license 14)
Tested by: ranjtech
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@298050 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | configure | 13 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | include/asterisk/autoconfig.h.in | 3 | ||||
-rw-r--r-- | main/netsock.c | 2 |
4 files changed, 17 insertions, 2 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 294429 . +# From configure.ac Revision: 296533 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.65 for asterisk 1.6.2. # @@ -11866,6 +11866,17 @@ _ACEOF fi +ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_ifru.ifru_hwaddr" "ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" "#include <net/if.h> +" +if test "x$ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR 1 +_ACEOF + + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then : diff --git a/configure.ac b/configure.ac index 8603f8673..e4b600a74 100644 --- a/configure.ac +++ b/configure.ac @@ -393,6 +393,7 @@ AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_blksize]) AC_CHECK_MEMBERS([struct ucred.uid, struct ucred.cr_uid], [], [], [#include <sys/socket.h>]) +AC_CHECK_MEMBERS([struct ifreq.ifr_ifru.ifru_hwaddr], [], [], [#include <net/if.h>]) AC_HEADER_TIME AC_STRUCT_TM AC_C_VOLATILE diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index fd22a3f5c..ae5f9d136 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -702,6 +702,9 @@ /* Define to 1 if you have the `strtoq' function. */ #undef HAVE_STRTOQ +/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */ +#undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR + /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE diff --git a/main/netsock.c b/main/netsock.c index e4cfb3bd3..02a143b64 100644 --- a/main/netsock.c +++ b/main/netsock.c @@ -234,7 +234,7 @@ char *ast_eid_to_str(char *s, int maxlen, struct ast_eid *eid) void ast_set_default_eid(struct ast_eid *eid) { -#if defined(SIOCGIFHWADDR) +#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR) int s, x = 0; char eid_str[20]; struct ifreq ifr; |