summaryrefslogtreecommitdiff
path: root/dissector.h
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-05-26 15:10:33 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-08-14 08:48:15 +0200
commit97e6f994785ce5f3f486f8eddb62df964119d121 (patch)
treed8452eb956ec0eb98b13c0a931dd5abce71c3400 /dissector.h
parentfa32dcaddab2363cb01acc81bddf7dc3d42ab5b1 (diff)
netsniff-ng: Restore tpacket v2 capturing
Some older systems (e.g. RHEL 6) don't have tpacket v3 available, but only tpacket v2. However, since commit d8cdc6a ("ring: netsniff-ng: migrate capture only to TPACKET_V3") we solely rely on tpacket v3 for capturing packets. This patch restores the possibility to capture using tpacket v2. For now this is just a fallback if the configure script doesn't detect tpacket v3 (and thus HAVE_TPACKET3 isn't set). Thus, on most modern systems this shouldn't change anything and they will continue using tpacket v3. For now this fix contains quite a bit of ugly #ifdefery which should be cleaned up in the future. Fixes #76 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'dissector.h')
-rw-r--r--dissector.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/dissector.h b/dissector.h
index f4963c9..c78ea48 100644
--- a/dissector.h
+++ b/dissector.h
@@ -77,15 +77,15 @@ static inline void __show_frame_hdr(uint8_t *packet, size_t len, int linktype,
tprintf("%s %s %u",
packet_types[pkttype] ? : "?",
if_indextoname(s_ll->sll_ifindex, tmp) ? : "?",
- v3 ? hdr.h3->tp_len : hdr.h2->tp_len);
+ tpacket_uhdr(hdr, tp_len, v3));
break;
default:
tprintf("%s %s %u %us.%uns %s\n",
packet_types[pkttype] ? : "?",
if_indextoname(s_ll->sll_ifindex, tmp) ? : "?",
- v3 ? hdr.h3->tp_len : hdr.h2->tp_len,
- v3 ? hdr.h3->tp_sec : hdr.h2->tp_sec,
- v3 ? hdr.h3->tp_nsec : hdr.h2->tp_nsec,
+ tpacket_uhdr(hdr, tp_len, v3),
+ tpacket_uhdr(hdr, tp_sec, v3),
+ tpacket_uhdr(hdr, tp_nsec, v3),
v3 ? "" : __show_ts_source(hdr.h2->tp_status));
break;
}