Changeset 2216d25
- Timestamp:
- 03/11/13 11:12:36 (9 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 524ebb5
- Parents:
- 6e6577d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracetop/tracetop.cc
r05a3177 r2216d25 17 17 #include <netpacket/packet.h> 18 18 #include <net/ethernet.h> 19 #else 20 #include <net/if_dl.h> 19 21 #endif 20 22 … … 90 92 size_t mybufflen = buffer ? bufflen : sizeof(intbuffer); 91 93 int err; 94 95 /* Some systems (FreeBSD and Solaris, I'm looking at you) have a bug 96 * where they can't deal with the idea of a sockaddr_storage being 97 * passed into getnameinfo. Linux just deals by looking 98 * at sa_family and figuring out what sockaddr it is really. 99 * 100 * Anyway, the fix appears to be to manually hax the sockaddr length 101 * to be the right value for the underlying family. 102 */ 92 103 switch (a->sa_family) { 93 104 case AF_INET: 94 case AF_INET6:105 salen = sizeof(struct sockaddr_in); 95 106 if ((err=getnameinfo(a, salen, mybuf, mybufflen, NULL, 0, NI_NUMERICHOST))!=0) { 96 107 strncpy(mybuf,gai_strerror(err),mybufflen); 97 108 } 98 109 break; 110 case AF_INET6: 111 salen = sizeof(struct sockaddr_in6); 112 if ((err=getnameinfo(a, salen, mybuf, mybufflen, NULL, 0, NI_NUMERICHOST))!=0) { 113 strncpy(mybuf,gai_strerror(err),mybufflen); 114 } 115 break; 99 116 #ifdef HAVE_NETPACKET_PACKET_H 100 117 case AF_PACKET: 101 118 trace_ether_ntoa(((struct sockaddr_ll*)a)->sll_addr, mybuf); 119 break; 120 #else 121 case AF_LINK: 122 trace_ether_ntoa((uint8_t *)((struct sockaddr_dl *)a)->sdl_data, mybuf); 102 123 break; 103 124 #endif
Note: See TracChangeset
for help on using the changeset viewer.