[asterisk-commits] russell: branch 10 r353078 - in /branches/10: ./ main/netsock.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 27 22:27:57 CST 2012
Author: russell
Date: Fri Jan 27 22:27:55 2012
New Revision: 353078
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=353078
Log:
Update ast_set_default_eid() to find more network interfaces.
As of Fedora 15, ethN is not the name of ethernet interfaces. The names
are emN or pciN. Update some code that searched for interfaces named
ethN to look for the new names, as well. For more information about why
this change was made, see this page:
http://domsch.com/blog/?p=455
........
Merged revisions 353077 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/main/netsock.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/main/netsock.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/netsock.c?view=diff&rev=353078&r1=353077&r2=353078
==============================================================================
--- branches/10/main/netsock.c (original)
+++ branches/10/main/netsock.c Fri Jan 27 22:27:55 2012
@@ -245,10 +245,22 @@
if (s < 0)
return;
for (x = 0; x < 10; x++) {
+ static const char *prefixes[] = { "eth", "em", "pci" };
+ unsigned int i;
+
memset(&ifr, 0, sizeof(ifr));
- snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "eth%d", x);
- if (ioctl(s, SIOCGIFHWADDR, &ifr))
+
+ for (i = 0; i < ARRAY_LEN(prefixes); i++) {
+ snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", prefixes[i], x);
+ if (!ioctl(s, SIOCGIFHWADDR, &ifr)) {
+ break;
+ }
+ }
+
+ if (i == ARRAY_LEN(prefixes)) {
continue;
+ }
+
memcpy(eid, ((unsigned char *)&ifr.ifr_hwaddr) + 2, sizeof(*eid));
ast_debug(1, "Seeding global EID '%s' from '%s' using 'siocgifhwaddr'\n", ast_eid_to_str(eid_str, sizeof(eid_str), eid), ifr.ifr_name);
close(s);
More information about the asterisk-commits
mailing list