From d84a6b7139f3c6d0eb70615543cf368350000e5b Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 24 Aug 2015 14:46:02 +0200 Subject: netsniff-ng: Use correct flag to check tpacket uhdr validity When fixing up a build error introduced by commit 579e8524 ("netsniff-ng: vlan: Show vlan info from tpacket v3"), the used definitions got mixed up and TP_STATUS_VLAN_TPID_VALID ended up not being checked at all. Fix this up and make the code a bit easier to read Fixes: 3384ee71 ("netsniff-ng: ring: Fix build if tp_vlan_tpid is not available in kernel header") Signed-off-by: Tobias Klauser --- ring.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ring.h') diff --git a/ring.h b/ring.h index 56c305d..a195f74 100644 --- a/ring.h +++ b/ring.h @@ -67,14 +67,13 @@ static inline uint16_t tpacket_uhdr_vlan_proto(union tpacket_uhdr *hdr, bool v3) static inline bool tpacket_has_vlan_info(union tpacket_uhdr *hdr) { - uint32_t valid = 0; + uint32_t valid = TP_STATUS_VLAN_VALID; #ifdef TP_STATUS_VLAN_TPID_VALID - valid = TP_STATUS_VLAN_VALID; + valid |= TP_STATUS_VLAN_TPID_VALID; #endif - return tpacket_uhdr(*hdr, tp_status, true) & - (TP_STATUS_VLAN_VALID | valid); + return tpacket_uhdr(*hdr, tp_status, true) & valid; } struct frame_map { -- cgit v1.2.3-54-g00ecf