aboutsummaryrefslogtreecommitdiff
path: root/pcap-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 74816892..878f27f0 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -117,6 +117,19 @@
# define HAVE_TPACKET3
#endif /* TPACKET3_HDRLEN */
+/*
+ * Not all compilers that are used to compile code to run on Linux have
+ * these builtins. For example, older versions of GCC don't, and at
+ * least some people are doing cross-builds for MIPS with older versions
+ * of GCC.
+ */
+#ifndef HAVE___ATOMIC_LOAD_N
+#define __atomic_load_n(ptr, memory_model) (*(ptr))
+#endif
+#ifndef HAVE___ATOMIC_STORE_N
+#define __atomic_store_n(ptr, val, memory_model) *(ptr) = (val)
+#endif
+
#define packet_mmap_acquire(pkt) \
(__atomic_load_n(&pkt->tp_status, __ATOMIC_ACQUIRE) != TP_STATUS_KERNEL)
#define packet_mmap_release(pkt) \
@@ -3880,7 +3893,7 @@ static int pcap_handle_packet_mmap(
}
if (handlep->filter_in_userland && handle->fcode.bf_insns) {
- struct bpf_aux_data aux_data;
+ struct pcap_bpf_aux_data aux_data;
aux_data.vlan_tag_present = tp_vlan_tci_valid;
aux_data.vlan_tag = tp_vlan_tci & 0x0fff;