From b67df4299c18ba3f3fb30a2e3488873bd49d4153 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Tue, 20 Aug 2013 10:50:10 +0200 Subject: configure: allow trafgen build when only TPACKET_V2 is available On machines like RHEL6 that do not have support for TPACKET_V3, we should still allow at least trafgen to be built for network testing. Thus, do something useful with the TPACKET_V3 configure check and comment out in ring.h relevant structures. Signed-off-by: Daniel Borkmann --- ring.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ring.h') diff --git a/ring.h b/ring.h index 7ee7735..1ab81b0 100644 --- a/ring.h +++ b/ring.h @@ -25,11 +25,14 @@ #include "built_in.h" #include "die.h" #include "dev.h" +#include "config.h" union tpacket_uhdr { struct tpacket_hdr *h1; struct tpacket2_hdr *h2; +#ifdef HAVE_TPACKET3 struct tpacket3_hdr *h3; +#endif void *raw; }; @@ -38,11 +41,13 @@ struct frame_map { struct sockaddr_ll s_ll __align_tpacket(sizeof(struct tpacket2_hdr)); }; +#ifdef HAVE_TPACKET3 struct block_desc { uint32_t version; uint32_t offset_to_priv; struct tpacket_hdr_v1 h1; }; +#endif struct ring { struct iovec *frames; @@ -51,7 +56,9 @@ struct ring { struct sockaddr_ll s_ll; union { struct tpacket_req layout; +#ifdef HAVE_TPACKET3 struct tpacket_req3 layout3; +#endif uint8_t raw; }; }; @@ -140,7 +147,9 @@ static inline void set_sockopt_tpacket_v2(int sock) static inline void set_sockopt_tpacket_v3(int sock) { +#ifdef HAVE_TPACKET3 __set_sockopt_tpacket(sock, TPACKET_V3); +#endif } static inline int get_sockopt_tpacket(int sock) -- cgit v1.2.3-54-g00ecf