This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FixRM #6355]
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- pcap-linux.c 2010-03-11 17:56:54.000000000 -0800 | ||
+++ /opt/libpcap-1.1.1/pcap-linux.c 2014-07-11 13:18:06.133832775 -0700 | ||
@@ -3378,6 +3378,9 @@ | ||
unsigned int tp_snaplen; | ||
unsigned int tp_sec; | ||
unsigned int tp_usec; | ||
+ unsigned int ulong_size = 4; | ||
+ unsigned char *raw_data; | ||
+ struct utsname utsbuf; | ||
|
||
h.raw = pcap_get_ring_frame(handle, TP_STATUS_USER); | ||
if (!h.raw) | ||
@@ -3385,11 +3388,19 @@ | ||
|
||
switch (handle->md.tp_version) { | ||
case TPACKET_V1: | ||
- tp_len = h.h1->tp_len; | ||
- tp_mac = h.h1->tp_mac; | ||
- tp_snaplen = h.h1->tp_snaplen; | ||
- tp_sec = h.h1->tp_sec; | ||
- tp_usec = h.h1->tp_usec; | ||
+ raw_data = (unsigned char *)h.raw; | ||
+ if (uname(&utsbuf) != -1) { | ||
+ if(strstr(utsbuf.machine, "64") == NULL) { | ||
+ ulong_size = 4; | ||
+ } else { | ||
+ ulong_size = 8; | ||
+ } | ||
+ } | ||
+ tp_len = (__u32)raw_data[ulong_size]; | ||
+ tp_mac = (__u16)raw_data[ulong_size + 8]; | ||
+ tp_snaplen = (__u32)raw_data[ulong_size + 4]; | ||
+ tp_sec = (__u32)raw_data[ulong_size + 12]; | ||
+ tp_usec = (__u32)raw_data[ulong_size + 16]; | ||
break; | ||
#ifdef HAVE_TPACKET2 | ||
case TPACKET_V2: |