|
|
@ -37,6 +37,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <net/if.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/file.h"
|
|
|
|
#include "asterisk/logger.h"
|
|
|
|
#include "asterisk/logger.h"
|
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/channel.h"
|
|
|
@ -399,8 +404,7 @@ static void reset_global_eid(void)
|
|
|
|
if (ioctl(s, SIOCGIFHWADDR, &ifr))
|
|
|
|
if (ioctl(s, SIOCGIFHWADDR, &ifr))
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
memcpy(&global_eid, ((unsigned char *)&ifr.ifr_hwaddr) + 2, sizeof(global_eid));
|
|
|
|
memcpy(&global_eid, ((unsigned char *)&ifr.ifr_hwaddr) + 2, sizeof(global_eid));
|
|
|
|
ast_debug(1, "Seeding global EID '%s' from '%s'\n",
|
|
|
|
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);
|
|
|
|
dundi_eid_to_str(eid_str, sizeof(eid_str), &global_eid), ifr.ifr_name);
|
|
|
|
|
|
|
|
close(s);
|
|
|
|
close(s);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -413,12 +417,10 @@ static void reset_global_eid(void)
|
|
|
|
if (getifaddrs(&ifap) == 0) {
|
|
|
|
if (getifaddrs(&ifap) == 0) {
|
|
|
|
struct ifaddrs *p;
|
|
|
|
struct ifaddrs *p;
|
|
|
|
for (p = ifap; p; p = p->ifa_next) {
|
|
|
|
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;
|
|
|
|
struct sockaddr_dl* sdp = (struct sockaddr_dl*) p->ifa_addr;
|
|
|
|
memcpy(
|
|
|
|
memcpy(&(global_eid.eid), sdp->sdl_data + sdp->sdl_nlen, 6);
|
|
|
|
&(global_eid.eid),
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
|
|
|
|
freeifaddrs(ifap);
|
|
|
|
freeifaddrs(ifap);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -427,7 +429,7 @@ static void reset_global_eid(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#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)
|
|
|
|
static int get_trans_id(void)
|
|
|
|