4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 31413f1 was
31413f1,
checked in by Shane Alcock <salcock@…>, 11 years ago
|
- Only decode the next header after an IPv6 fragmentation header if the current fragment is the first one
|
-
Property mode set to
100644
|
File size:
864 bytes
|
Line | |
---|
1 | #include <sys/types.h> |
---|
2 | #include <netinet/in.h> |
---|
3 | #include <stdio.h> |
---|
4 | #include "libpacketdump.h" |
---|
5 | #include "libtrace.h" |
---|
6 | |
---|
7 | DLLEXPORT void decode(int link_type UNUSED, const char *packet, unsigned len) |
---|
8 | { |
---|
9 | libtrace_ip6_frag_t *frag = (libtrace_ip6_frag_t *)packet; |
---|
10 | uint16_t offset; |
---|
11 | |
---|
12 | // IPv6 Fragment Header |
---|
13 | if (len == 0) { |
---|
14 | printf(" IPv6 Frag: [Truncated]\n"); |
---|
15 | return; |
---|
16 | } |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | printf(" IPv6 Frag: Next Header: %u\n", frag->nxt); |
---|
21 | |
---|
22 | offset = ntohs(frag->frag_off); |
---|
23 | printf(" IPv6 Frag: Offset: %u", offset & 0xFFF8); |
---|
24 | if ((offset & 0x1)) printf(" MORE_FRAG"); |
---|
25 | |
---|
26 | printf("\n"); |
---|
27 | printf(" IPv6 Frag: Identification: %u\n", ntohl(frag->ident)); |
---|
28 | |
---|
29 | /* Only dump the next header if this is the first fragment */ |
---|
30 | if ((offset & 0xFFF8) != 0) |
---|
31 | return; |
---|
32 | |
---|
33 | decode_next(packet + sizeof(libtrace_ip6_frag_t), |
---|
34 | len - sizeof(libtrace_ip6_frag_t), "ip", frag->nxt); |
---|
35 | return; |
---|
36 | |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.