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() */
15 #include "dissector_eth.h"
24 static void QinQ_full(struct pkt_buff
*pkt
)
27 struct QinQhdr
*QinQ
= (struct QinQhdr
*) pkt_pull(pkt
, sizeof(*QinQ
));
32 tci
= ntohs(QinQ
->TCI
);
34 tprintf(" [ VLAN QinQ ");
35 tprintf("Prio (%d), ", (tci
& 0xE000) >> 13);
36 tprintf("DEI (%d), ", (tci
& 0x1000) >> 12);
37 tprintf("ID (%d), ", (tci
& 0x0FFF));
38 tprintf("Proto (0x%.4x)", ntohs(QinQ
->TPID
));
41 pkt_set_proto(pkt
, ð_lay2
, ntohs(QinQ
->TPID
));
44 static void QinQ_less(struct pkt_buff
*pkt
)
47 struct QinQhdr
*QinQ
= (struct QinQhdr
*) pkt_pull(pkt
, sizeof(*QinQ
));
52 tci
= ntohs(QinQ
->TCI
);
54 tprintf(" VLAN%d", (tci
& 0x0FFF));
56 pkt_set_proto(pkt
, ð_lay2
, ntohs(QinQ
->TPID
));
59 struct protocol QinQ_ops
= {
61 .print_full
= QinQ_full
,
62 .print_less
= QinQ_less
,