diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2015-08-17 00:21:31 +0300 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-08-17 09:54:55 +0200 |
commit | 579e8524cb9c68dab9117981966b18d2494b0787 (patch) | |
tree | 2bbf08b50cd14071a0602bbb9dbd116dd1612c82 /dissector.h | |
parent | f4b90d0194cdb5275823116b2229c04249225d7e (diff) |
netsniff-ng: vlan: Show vlan info from tpacket v3
Show vlan info (vid, prio & proto) from tpacket struct, in separated
line. It might be useful to sniff it in case if vlan reordering is on
(which is by default) and physical (vlan underlying) device supports
vlan offloading.
Meanwhile it uses only v3 tpacket info as location of vlan fields are
different between v2 & v3 (v1 does not have it at all), but current code
only has possibility to check if v3 is used which is not enough.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[ tk: make print format consistent with VLAN dissector ]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'dissector.h')
-rw-r--r-- | dissector.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dissector.h b/dissector.h index 5580110..226d2bc 100644 --- a/dissector.h +++ b/dissector.h @@ -17,6 +17,7 @@ #include "ring.h" #include "tprintf.h" #include "linktype.h" +#include "proto_vlan.h" #define PRINT_NORM 0 #define PRINT_LESS 1 @@ -91,6 +92,17 @@ static inline void __show_frame_hdr(uint8_t *packet, size_t len, int linktype, tpacket_uhdr(hdr, tp_nsec, v3), count, v3 ? "" : __show_ts_source(hdr.h2->tp_status)); + + if (tpacket_has_vlan_info(&hdr)) { + uint16_t tci = tpacket_uhdr_vlan_tci(&hdr, v3); + + tprintf(" [ tpacketv3 VLAN "); + tprintf("Prio (%u), ", vlan_tci2prio(tci)); + tprintf("CFI (%u), ", vlan_tci2cfi(tci)); + tprintf("ID (%u), ", vlan_tci2vid(tci)); + tprintf("Proto (0x%.4x)", tpacket_uhdr_vlan_proto(&hdr, v3)); + tprintf(" ]\n"); + } break; } } |