From 97e6f994785ce5f3f486f8eddb62df964119d121 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 26 May 2014 15:10:33 +0200 Subject: 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 --- pcap_io.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pcap_io.h') diff --git a/pcap_io.h b/pcap_io.h index 061c214..529cde0 100644 --- a/pcap_io.h +++ b/pcap_io.h @@ -416,6 +416,7 @@ static inline void tpacket_hdr_to_pcap_pkthdr(struct tpacket2_hdr *thdr, thdr->tp_status, sll, phdr, type); } +#ifdef HAVE_TPACKET3 static inline void tpacket3_hdr_to_pcap_pkthdr(struct tpacket3_hdr *thdr, struct sockaddr_ll *sll, pcap_pkthdr_t *phdr, @@ -425,6 +426,7 @@ static inline void tpacket3_hdr_to_pcap_pkthdr(struct tpacket3_hdr *thdr, thdr->tp_snaplen, thdr->tp_len, 0, sll, phdr, type); } +#endif static inline void pcap_pkthdr_to_tpacket_hdr(pcap_pkthdr_t *phdr, enum pcap_type type, -- cgit v1.2.3-54-g00ecf