summaryrefslogtreecommitdiff
path: root/proto_vlan.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-08-17 00:21:30 +0300
committerTobias Klauser <tklauser@distanz.ch>2015-08-17 09:43:27 +0200
commitf4b90d0194cdb5275823116b2229c04249225d7e (patch)
tree703e59f323c3e9875aec66f764b365c88f8391cc /proto_vlan.c
parent69cb4a22c8bbe841ec3b0bf1983610548f4dce74 (diff)
netsniff-ng: vlan: Use helpers when parse vlan header
Add proto_vlan.h with helpers to parse VLAN fields. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'proto_vlan.c')
-rw-r--r--proto_vlan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/proto_vlan.c b/proto_vlan.c
index a175dde..c1b3e65 100644
--- a/proto_vlan.c
+++ b/proto_vlan.c
@@ -10,6 +10,7 @@
#include <netinet/in.h> /* for ntohs() */
#include "proto.h"
+#include "proto_vlan.h"
#include "dissector_eth.h"
#include "pkt_buff.h"
@@ -29,9 +30,9 @@ static void vlan(struct pkt_buff *pkt)
tci = ntohs(vlan->h_vlan_TCI);
tprintf(" [ VLAN ");
- tprintf("Prio (%d), ", (tci & 0xE000) >> 13);
- tprintf("CFI (%d), ", (tci & 0x1000) >> 12);
- tprintf("ID (%d), ", (tci & 0x0FFF));
+ tprintf("Prio (%d), ", vlan_tci2prio(tci));
+ tprintf("CFI (%d), ", vlan_tci2cfi(tci));
+ tprintf("ID (%d), ", vlan_tci2vid(tci));
tprintf("Proto (0x%.4x)", ntohs(vlan->h_vlan_encapsulated_proto));
tprintf(" ]\n");