Blob Blame History Raw
From 98e98bf9cc6ee76d7861db966708b1e51cc6e014 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 15 Sep 2015 13:30:37 +0200
Subject: [PATCH] bpf: make sure sll header size if accounted for

This got reverted when backporting bpf_filter_with_auxdata.

Related: #1176612
---
 pcap-linux.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pcap-linux.c b/pcap-linux.c
index a5b8953..f7f2aae 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -4306,7 +4306,7 @@ static int pcap_handle_packet_mmap(
                 aux_data.vlan_tag = tp_vlan_tci & 0x0fff;
                 aux_data.vlan_tag_present = tp_vlan_tci_valid;
 
-                if (bpf_filter_with_aux_data(handle->fcode.bf_insns, bp, tp_len, tp_snaplen, &aux_data) == 0)
+                if (bpf_filter_with_aux_data(handle->fcode.bf_insns, bp, tp_len, snaplen, &aux_data) == 0)
                         return 0;
         }
 
@@ -4316,7 +4316,7 @@ static int pcap_handle_packet_mmap(
 	/* get required packet info from ring header */
 	pcaphdr.ts.tv_sec = tp_sec;
 	pcaphdr.ts.tv_usec = tp_usec;
-	pcaphdr.caplen = tp_snaplen;
+	pcaphdr.caplen = snaplen;
 	pcaphdr.len = tp_len;
 
 	/* if required build in place the sll header*/
@@ -4329,7 +4329,7 @@ static int pcap_handle_packet_mmap(
 #if defined(HAVE_TPACKET2) || defined(HAVE_TPACKET3)
 	if (tp_vlan_tci_valid &&
 		handlep->vlan_offset != -1 &&
-		tp_snaplen >= (unsigned int) handlep->vlan_offset)
+		snaplen >= (unsigned int) handlep->vlan_offset)
 	{
 		struct vlan_tag *tag;
 
-- 
2.4.3