4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 47de0aa was
4e65f42,
checked in by Shane Alcock <salcock@…>, 16 years ago
|
Fixed segmentation faults when trace_destroy is called on a trace that wasn't successfully created
libdl is now checked for and only linked against if available (BSD's don't have a libdl)
Fixed the libpacketdump .so's to use libtrace's generic protocol headers as well as trace_ether_ntoa
Added missing check for strlcpy
Added a couple of #defines to various tools that needed them under FreeBSD
Removed some needless #includes from the libpacketdump .so's
|
-
Property mode set to
100644
|
File size:
740 bytes
|
Line | |
---|
1 | #include <netinet/in.h> |
---|
2 | #include <stdio.h> |
---|
3 | #include <inttypes.h> |
---|
4 | #include <dlfcn.h> |
---|
5 | #include "libtrace.h" |
---|
6 | #include "libpacketdump.h" |
---|
7 | |
---|
8 | extern "C" |
---|
9 | void decode(int link_type,char *packet,int len) |
---|
10 | { |
---|
11 | char ether_buf[18] = {0, }; |
---|
12 | printf(" Ethernet:"); |
---|
13 | if (len>=6) |
---|
14 | printf(" Dest: %s",trace_ether_ntoa((uint8_t *)packet, |
---|
15 | ether_buf)); |
---|
16 | else { |
---|
17 | printf("[|Truncated]\n"); |
---|
18 | return; |
---|
19 | } |
---|
20 | if (len>=12) |
---|
21 | printf(" Source: %s",trace_ether_ntoa((uint8_t*)(packet+6), |
---|
22 | ether_buf)); |
---|
23 | else { |
---|
24 | printf("[|Truncated]\n"); |
---|
25 | return; |
---|
26 | } |
---|
27 | if (len>=14) { |
---|
28 | uint16_t type = htons(*(uint16_t*)(packet+12)); |
---|
29 | printf(" Ethertype: %04x\n",type); |
---|
30 | decode_next(packet+14,len-14,"eth",type); |
---|
31 | } |
---|
32 | else { |
---|
33 | printf("[|Truncated]\n"); |
---|
34 | return; |
---|
35 | } |
---|
36 | return; |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.