2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2012 Markus Amend <markus@netsniff-ng.org>, Deutsche Flugsicherung GmbH
4 * Subject to the GPL, version 2.
6 * IPv6 Fragmentation Header described in RFC2460
11 #include <netinet/in.h> /* for ntohs() */
14 #include "dissector_eth.h"
19 uint8_t h_fragm_next_header
;
20 uint8_t h_fragm_reserved
;
21 uint16_t h_fragm_off_res_M
;
22 uint32_t h_fragm_identification
;
25 static void fragm(struct pkt_buff
*pkt
)
28 struct fragmhdr
*fragm_ops
;
30 fragm_ops
= (struct fragmhdr
*) pkt_pull(pkt
, sizeof(*fragm_ops
));
31 if (fragm_ops
== NULL
)
34 off_res_M
= ntohs(fragm_ops
->h_fragm_off_res_M
);
36 tprintf("\t [ Fragment ");
37 tprintf("NextHdr (%u), ", fragm_ops
->h_fragm_next_header
);
38 tprintf("Reserved (%u), ", fragm_ops
->h_fragm_reserved
);
39 tprintf("Offset (%u), ", off_res_M
>> 3);
40 tprintf("Res (%u), ", (off_res_M
>> 1) & 0x3);
41 tprintf("M flag (%u), ", off_res_M
& 0x1);
42 tprintf("Identification (%u)",
43 ntohl(fragm_ops
->h_fragm_identification
));
46 pkt_set_dissector(pkt
, ð_lay3
, fragm_ops
->h_fragm_next_header
);
49 static void fragm_less(struct pkt_buff
*pkt
)
52 struct fragmhdr
*fragm_ops
;
54 fragm_ops
= (struct fragmhdr
*) pkt_pull(pkt
, sizeof(*fragm_ops
));
55 if (fragm_ops
== NULL
)
58 off_res_M
= ntohs(fragm_ops
->h_fragm_off_res_M
);
60 tprintf(" FragmOffs %u", off_res_M
>> 3);
62 pkt_set_dissector(pkt
, ð_lay3
, fragm_ops
->h_fragm_next_header
);
65 struct protocol ipv6_fragm_ops
= {
68 .print_less
= fragm_less
,