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 * http://www.ieee802.org/1/pages/802.1ad.html
11 #include <netinet/in.h> /* for ntohs() */
14 #include "dissector_eth.h"
23 static void QinQ_full(struct pkt_buff
*pkt
)
26 struct QinQhdr
*QinQ
= (struct QinQhdr
*) pkt_pull(pkt
, sizeof(*QinQ
));
31 tci
= ntohs(QinQ
->TCI
);
33 tprintf(" [ VLAN QinQ ");
34 tprintf("Prio (%d), ", (tci
& 0xE000) >> 13);
35 tprintf("DEI (%d), ", (tci
& 0x1000) >> 12);
36 tprintf("ID (%d), ", (tci
& 0x0FFF));
37 tprintf("Proto (0x%.4x)", ntohs(QinQ
->TPID
));
40 pkt_set_dissector(pkt
, ð_lay2
, ntohs(QinQ
->TPID
));
43 static void QinQ_less(struct pkt_buff
*pkt
)
46 struct QinQhdr
*QinQ
= (struct QinQhdr
*) pkt_pull(pkt
, sizeof(*QinQ
));
51 tci
= ntohs(QinQ
->TCI
);
53 tprintf(" VLAN%d", (tci
& 0x0FFF));
55 pkt_set_dissector(pkt
, ð_lay2
, ntohs(QinQ
->TPID
));
58 struct protocol QinQ_ops
= {
60 .print_full
= QinQ_full
,
61 .print_less
= QinQ_less
,