From 89c9d876cffac1867b668359f3b60657450130a1 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Mon, 22 Apr 2013 22:51:09 +0200 Subject: 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 --- ring_tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-54-g00ecf