aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-11 22:46:21 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-11 22:46:21 +0000
commit56c61d75a3f4565d20b5924d215c89cabf8d6e9a (patch)
treec3c2f5caaceb6d440b1f9a80c891aa23ec580d11 /pbx
parentf6fe74519fce7fa2e8c1f106e0f7fb2a35656277 (diff)
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/branches/1.4@98390 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_dundi.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 020e33050..89a2729b4 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -415,7 +415,7 @@ static void reset_global_eid(void)
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "eth%d", x);
if (!ioctl(s, SIOCGIFHWADDR, &ifr)) {
memcpy(&global_eid, ((unsigned char *)&ifr.ifr_hwaddr) + 2, sizeof(global_eid));
- ast_log(LOG_DEBUG, "Seeding global EID '%s' from '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &global_eid), ifr.ifr_name);
+ ast_log(LOG_DEBUG, "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;
}
@@ -430,12 +430,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_log(LOG_DEBUG, "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_log(LOG_DEBUG, "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;
}
@@ -444,7 +442,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)