summaryrefslogtreecommitdiff
path: root/ring.h
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-08-20 10:50:10 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-08-20 10:53:20 +0200
commitb67df4299c18ba3f3fb30a2e3488873bd49d4153 (patch)
tree1a7ec4d77447a217c307fce96eac01d05b9916f7 /ring.h
parent1b554ed8277dd027db458a029dfbe90d04e212b6 (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'ring.h')
-rw-r--r--ring.h9
1 files changed, 9 insertions, 0 deletions
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)