source: libpacketdump/ip_44.c @ ae3779b

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since ae3779b was e845da6, checked in by Shane Alcock <salcock@…>, 10 years ago
  • Added a libpacketdump decoder for IPv6 fragment headers
  • Fixed identation of IPv6 header fields in libpacketdump
  • Property mode set to 100644
File size: 761 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
7DLLEXPORT 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        decode_next(packet + sizeof(libtrace_ip6_frag_t), 
30                        len - sizeof(libtrace_ip6_frag_t), "ip", frag->nxt);
31        return; 
32
33}
Note: See TracBrowser for help on using the repository browser.