summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-04-22 22:51:09 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-04-22 22:51:09 +0200
commit89c9d876cffac1867b668359f3b60657450130a1 (patch)
tree2e47b288734c583865ccae8d3775ec55d3889407
parent2640c81e49ad52a5223689bffcbe8c1c14ddfdc9 (diff)
ring_tx: user_may_pull_from_tx: fix check for user frame
TP_STATUS_AVAILABLE is 0, thus the condition will always be successful. Fix this bug by properly checking kernel flags. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--ring_tx.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ring_tx.h b/ring_tx.h
index 769f27e..eff7235 100644
--- a/ring_tx.h
+++ b/ring_tx.h
@@ -24,7 +24,7 @@ extern void set_packet_loss_discard(int sock);
static inline int user_may_pull_from_tx(struct tpacket2_hdr *hdr)
{
- return ((hdr->tp_status & TP_STATUS_AVAILABLE) == TP_STATUS_AVAILABLE);
+ return !(hdr->tp_status & (TP_STATUS_SEND_REQUEST | TP_STATUS_SENDING));
}
static inline void kernel_may_pull_from_tx(struct tpacket2_hdr *hdr)