diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-11 22:52:41 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-11 22:52:41 +0000 |
commit | f001e3f2ec3ecf55b797e943761e7ce11d3ac59a (patch) | |
tree | 3e4a655fa418b6712fb872194896c8291a5448c1 /pbx | |
parent | 82a225c7872e24348569bb472baa190868fb9a1a (diff) |
Merged revisions 98390 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r98390 | russell | 2008-01-11 16:46:21 -0600 (Fri, 11 Jan 2008) | 9 lines
Fix up setting the EID on BSD based systems.
(closes issue #11646)
Reported by: caio1982
Patches:
dundi_osx_eid6.diff.txt uploaded by caio1982 (license 22)
dundi_osx_eid6-1.4.diff uploaded by caio1982 (license 22)
Tested by: caio1982, mvanbaak
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@98400 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_dundi.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 62e55abf9..26a3e51a2 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -37,6 +37,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <pthread.h> #include <net/if.h> +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__) +#include <net/if_dl.h> +#include <ifaddrs.h> +#endif + #include "asterisk/file.h" #include "asterisk/logger.h" #include "asterisk/channel.h" @@ -399,8 +404,7 @@ static void reset_global_eid(void) if (ioctl(s, SIOCGIFHWADDR, &ifr)) continue; memcpy(&global_eid, ((unsigned char *)&ifr.ifr_hwaddr) + 2, sizeof(global_eid)); - ast_debug(1, "Seeding global EID '%s' from '%s'\n", - dundi_eid_to_str(eid_str, sizeof(eid_str), &global_eid), ifr.ifr_name); + ast_debug(1, "Seeding global EID '%s' from '%s' using 'siocgifhwaddr'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &global_eid), ifr.ifr_name); close(s); return; } @@ -413,12 +417,10 @@ static void reset_global_eid(void) if (getifaddrs(&ifap) == 0) { struct ifaddrs *p; for (p = ifap; p; p = p->ifa_next) { - if (p->ifa_addr->sa_family == AF_LINK) { + if ((p->ifa_addr->sa_family == AF_LINK) && !(p->ifa_flags & IFF_LOOPBACK) && (p->ifa_flags & IFF_RUNNING)) { struct sockaddr_dl* sdp = (struct sockaddr_dl*) p->ifa_addr; - memcpy( - &(global_eid.eid), - sdp->sdl_data + sdp->sdl_nlen, 6); - ast_debug(1, "Seeding global EID '%s' from '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &global_eid), ifap->ifa_name); + memcpy(&(global_eid.eid), sdp->sdl_data + sdp->sdl_nlen, 6); + ast_debug(1, "Seeding global EID '%s' from '%s' using 'getifaddrs'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &global_eid), p->ifa_name); freeifaddrs(ifap); return; } @@ -427,7 +429,7 @@ static void reset_global_eid(void) } #endif #endif - ast_log(LOG_NOTICE, "No ethernet interface found for seeding global EID You will have to set it manually.\n"); + ast_log(LOG_NOTICE, "No ethernet interface found for seeding global EID. You will have to set it manually.\n"); } static int get_trans_id(void) |