libpcap
1.10.1
About: libpcap is a packet filter library used by tools like tcpdump.
![]() ![]() |
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
#include <sys/mman.h>
#include <linux/if.h>
#include <linux/if_packet.h>
#include <linux/sockios.h>
#include <linux/ethtool.h>
#include <netinet/in.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <poll.h>
#include <dirent.h>
#include <sys/eventfd.h>
#include "pcap-int.h"
#include "pcap/sll.h"
#include "pcap/vlan.h"
#include "diag-control.h"
#include <linux/types.h>
#include <linux/filter.h>
#include <linux/if_bonding.h>
Go to the source code of this file.
Data Structures | |
struct | pcap_linux |
union | thdr |
struct | dsa_proto |
Macros | |
#define | _GNU_SOURCE |
#define | __atomic_load_n(ptr, memory_model) (*(ptr)) |
#define | __atomic_store_n(ptr, val, memory_model) *(ptr) = (val) |
#define | packet_mmap_acquire(pkt) (__atomic_load_n(&pkt->tp_status, __ATOMIC_ACQUIRE) != TP_STATUS_KERNEL) |
#define | packet_mmap_release(pkt) (__atomic_store_n(&pkt->tp_status, TP_STATUS_KERNEL, __ATOMIC_RELEASE)) |
#define | packet_mmap_v3_acquire(pkt) (__atomic_load_n(&pkt->hdr.bh1.block_status, __ATOMIC_ACQUIRE) != TP_STATUS_KERNEL) |
#define | packet_mmap_v3_release(pkt) (__atomic_store_n(&pkt->hdr.bh1.block_status, TP_STATUS_KERNEL, __ATOMIC_RELEASE)) |
#define | MAX_LINKHEADER_SIZE 256 |
#define | BIGGER_THAN_ALL_MTUS (64*1024) |
#define | MUST_CLEAR_RFMON 0x00000001 /* clear rfmon (monitor) mode */ |
#define | MUST_DELETE_MONIF 0x00000002 /* delete monitor-mode interface */ |
#define | RING_GET_FRAME_AT(h, offset) (((u_char **)h->buffer)[(offset)]) |
#define | RING_GET_CURRENT_FRAME(h) RING_GET_FRAME_AT(h, h->offset) |
#define | VLAN_VALID(hdr, hv) ((hv)->tp_vlan_tci != 0 || ((hdr)->tp_status & 0x10)) |
#define | VLAN_TPID(hdr, hv) ETH_P_8021Q |
#define | ARPHRD_CAN 280 |
#define | ARPHRD_IEEE802_TR 800 /* From Linux 2.4 */ |
#define | ARPHRD_FDDI 774 |
#define | ARPHRD_ATM 19 |
#define | ARPHRD_IEEE80211 801 |
#define | ARPHRD_IEEE80211_PRISM 802 |
#define | ARPHRD_IEEE80211_RADIOTAP 803 |
#define | ARPHRD_CISCO 513 /* previously ARPHRD_HDLC */ |
#define | ARPHRD_SIT 776 /* From Linux 2.2.13 */ |
#define | ARPHRD_RAWHDLC 518 |
#define | ARPHRD_DLCI 15 |
#define | ARPHRD_FRAD 770 |
#define | ARPHRD_FCPP 784 |
#define | ARPHRD_FCAL 785 |
#define | ARPHRD_FCPL 786 |
#define | ARPHRD_FCFABRIC 787 |
#define | ARPHRD_IRDA 783 |
#define | ARPHRD_LAPD 8445 |
#define | ARPHRD_NONE 0xFFFE |
#define | ARPHRD_IEEE802154 804 |
#define | ARPHRD_NETLINK 824 |
#define | ARPHRD_VSOCKMON 826 |
#define | MAX(a, b) ((a)>(b)?(a):(b)) |
Typedefs | |
typedef int | socklen_t |
Functions | |
static int | get_if_flags (const char *, bpf_u_int32 *, char *) |
static int | is_wifi (const char *) |
static void | map_arphrd_to_dlt (pcap_t *, int, const char *, int) |
static int | pcap_activate_linux (pcap_t *) |
static int | activate_pf_packet (pcap_t *, int) |
static int | setup_mmapped (pcap_t *, int *) |
static int | pcap_can_set_rfmon_linux (pcap_t *) |
static int | pcap_inject_linux (pcap_t *, const void *, int) |
static int | pcap_stats_linux (pcap_t *, struct pcap_stat *) |
static int | pcap_setfilter_linux (pcap_t *, struct bpf_program *) |
static int | pcap_setdirection_linux (pcap_t *, pcap_direction_t) |
static int | pcap_set_datalink_linux (pcap_t *, int) |
static void | pcap_cleanup_linux (pcap_t *) |
static void | destroy_ring (pcap_t *handle) |
static int | create_ring (pcap_t *handle, int *status) |
static int | prepare_tpacket_socket (pcap_t *handle) |
static int | pcap_read_linux_mmap_v2 (pcap_t *, int, pcap_handler, u_char *) |
static int | pcap_setnonblock_linux (pcap_t *p, int nonblock) |
static int | pcap_getnonblock_linux (pcap_t *p) |
static void | pcap_oneshot_linux (u_char *user, const struct pcap_pkthdr *h, const u_char *bytes) |
static int | iface_get_id (int fd, const char *device, char *ebuf) |
static int | iface_get_mtu (int fd, const char *device, char *ebuf) |
static int | iface_get_arptype (int fd, const char *device, char *ebuf) |
static int | iface_bind (int fd, int ifindex, char *ebuf, int protocol) |
static int | enter_rfmon_mode (pcap_t *handle, int sock_fd, const char *device) |
static int | iface_get_offload (pcap_t *handle) |
static int | fix_program (pcap_t *handle, struct sock_fprog *fcode) |
static int | fix_offset (pcap_t *handle, struct bpf_insn *p) |
static int | set_kernel_filter (pcap_t *handle, struct sock_fprog *fcode) |
static int | reset_kernel_filter (pcap_t *handle) |
static int | iface_dsa_get_proto_info (const char *device, pcap_t *handle) |
pcap_t * | pcap_create_interface (const char *device, char *ebuf) |
static int | pcap_protocol (pcap_t *handle) |
static long long int | linux_get_stat (const char *if_name, const char *stat) |
static long long int | linux_if_drops (const char *if_name) |
static void | set_poll_timeout (struct pcap_linux *handlep) |
static void | pcap_breakloop_linux (pcap_t *handle) |
static int | linux_check_direction (const pcap_t *handle, const struct sockaddr_ll *sll) |
static int | device_still_exists (pcap_t *handle) |
static int | can_be_bound (const char *name) |
static int | get_if_ioctl_socket (void) |
int | pcap_platform_finddevs (pcap_if_list_t *devlistp, char *errbuf) |
static void | set_dlt_list_cooked (pcap_t *handle, int sock_fd) |
static int | init_tpacket (pcap_t *handle, int version, const char *version_str) |
static u_int | pcap_get_ring_frame_status (pcap_t *handle, int offset) |
static int | pcap_wait_for_frames_mmap (pcap_t *handle) |
static int | pcap_handle_packet_mmap (pcap_t *handle, pcap_handler callback, u_char *user, unsigned char *frame, unsigned int tp_len, unsigned int tp_mac, unsigned int tp_snaplen, unsigned int tp_sec, unsigned int tp_usec, int tp_vlan_tci_valid, __u16 tp_vlan_tci, __u16 tp_vlan_tpid) |
int | pcap_set_protocol_linux (pcap_t *p, int protocol) |
const char * | pcap_lib_version (void) |
Variables | |
static const struct timeval | netdown_timeout |
static struct sock_filter | total_insn = { (u_short)( 0x06 | 0x00 ), 0, 0, 0 } |
static struct sock_fprog | total_fcode = { 1, &total_insn } |
static const char | any_descr [] = "Pseudo-device that captures on all interfaces" |
static struct dsa_proto | dsa_protos [] |
#define __atomic_load_n | ( | ptr, | |
memory_model | |||
) | (*(ptr)) |
Definition at line 127 of file pcap-linux.c.
#define __atomic_store_n | ( | ptr, | |
val, | |||
memory_model | |||
) | *(ptr) = (val) |
Definition at line 130 of file pcap-linux.c.
#define _GNU_SOURCE |
Definition at line 71 of file pcap-linux.c.
#define ARPHRD_ATM 19 |
#define ARPHRD_CAN 280 |
#define ARPHRD_CISCO 513 /* previously ARPHRD_HDLC */ |
#define ARPHRD_DLCI 15 |
#define ARPHRD_FCAL 785 |
#define ARPHRD_FCFABRIC 787 |
#define ARPHRD_FCPL 786 |
#define ARPHRD_FCPP 784 |
#define ARPHRD_FDDI 774 |
#define ARPHRD_FRAD 770 |
#define ARPHRD_IEEE80211 801 |
#define ARPHRD_IEEE80211_PRISM 802 |
#define ARPHRD_IEEE80211_RADIOTAP 803 |
#define ARPHRD_IEEE802154 804 |
#define ARPHRD_IEEE802_TR 800 /* From Linux 2.4 */ |
#define ARPHRD_IRDA 783 |
#define ARPHRD_LAPD 8445 |
#define ARPHRD_NETLINK 824 |
#define ARPHRD_NONE 0xFFFE |
#define ARPHRD_RAWHDLC 518 |
#define ARPHRD_SIT 776 /* From Linux 2.2.13 */ |
#define ARPHRD_VSOCKMON 826 |
#define BIGGER_THAN_ALL_MTUS (64*1024) |
Definition at line 178 of file pcap-linux.c.
#define MAX | ( | a, | |
b | |||
) | ((a)>(b)?(a):(b)) |
Definition at line 2851 of file pcap-linux.c.
#define MAX_LINKHEADER_SIZE 256 |
Definition at line 171 of file pcap-linux.c.
#define MUST_CLEAR_RFMON 0x00000001 /* clear rfmon (monitor) mode */ |
Definition at line 215 of file pcap-linux.c.
#define MUST_DELETE_MONIF 0x00000002 /* delete monitor-mode interface */ |
Definition at line 216 of file pcap-linux.c.
#define packet_mmap_acquire | ( | pkt | ) | (__atomic_load_n(&pkt->tp_status, __ATOMIC_ACQUIRE) != TP_STATUS_KERNEL) |
Definition at line 133 of file pcap-linux.c.
#define packet_mmap_release | ( | pkt | ) | (__atomic_store_n(&pkt->tp_status, TP_STATUS_KERNEL, __ATOMIC_RELEASE)) |
Definition at line 135 of file pcap-linux.c.
#define packet_mmap_v3_acquire | ( | pkt | ) | (__atomic_load_n(&pkt->hdr.bh1.block_status, __ATOMIC_ACQUIRE) != TP_STATUS_KERNEL) |
Definition at line 137 of file pcap-linux.c.
#define packet_mmap_v3_release | ( | pkt | ) | (__atomic_store_n(&pkt->hdr.bh1.block_status, TP_STATUS_KERNEL, __ATOMIC_RELEASE)) |
Definition at line 139 of file pcap-linux.c.
#define RING_GET_CURRENT_FRAME | ( | h | ) | RING_GET_FRAME_AT(h, h->offset) |
Definition at line 244 of file pcap-linux.c.
#define RING_GET_FRAME_AT | ( | h, | |
offset | |||
) | (((u_char **)h->buffer)[(offset)]) |
Definition at line 243 of file pcap-linux.c.
#define VLAN_TPID | ( | hdr, | |
hv | |||
) | ETH_P_8021Q |
Definition at line 301 of file pcap-linux.c.
#define VLAN_VALID | ( | hdr, | |
hv | |||
) | ((hv)->tp_vlan_tci != 0 || ((hdr)->tp_status & 0x10)) |
Definition at line 295 of file pcap-linux.c.
typedef int socklen_t |
Definition at line 168 of file pcap-linux.c.
|
static |
Definition at line 2278 of file pcap-linux.c.
References pcap::bpf_codegen_flags, BPF_SPECIAL_VLAN_HANDLING, pcap::bufsize, close(), pcap_linux::cooked, pcap_opt::device, pcap::dlt_count, DLT_EN10MB, DLT_LINUX_IRDA, DLT_LINUX_LAPD, DLT_LINUX_SLL, pcap::dlt_list, DLT_NETLINK, enter_rfmon_mode(), pcap::errbuf, errno, ETH_ALEN, pcap::fd, getsockopt(), iface_bind(), iface_get_arptype(), iface_get_id(), pcap_linux::ifindex, pcap::linktype, pcap_linux::lo_ifindex, map_arphrd_to_dlt(), pcap_linux::mondevice, pcap::offset, pcap::opt, PCAP_ERRBUF_SIZE, PCAP_ERROR, PCAP_ERROR_PERM_DENIED, PCAP_ERROR_RFMON_NOTSUP, pcap_fmt_errmsg_for_errno(), PCAP_TSTAMP_PRECISION_NANO, PCAP_WARNING, pcap::priv, pcap_opt::promisc, pcap_opt::rfmon, set_dlt_list_cooked(), setsockopt(), SLL2_HDR_LEN, SLL_HDR_LEN, pcap::snapshot, snprintf(), socket(), pcap_opt::tstamp_precision, pcap_linux::vlan_offset, and VLAN_TAG_LEN.
Referenced by pcap_activate_linux().
|
static |
Definition at line 1393 of file pcap-linux.c.
Referenced by pcap_platform_finddevs().
|
static |
Definition at line 2863 of file pcap-linux.c.
References pcap::buffer, pcap_opt::buffer_size, pcap::bufsize, pcap::cc, destroy_ring(), pcap_opt::device, DLT_EN10MB, DLT_LINUX_SLL2, pcap::errbuf, errno, pcap::fd, getpagesize(), getsockopt(), iface_get_mtu(), iface_get_offload(), ioctl(), pcap::linktype, MAX, MAX_LINKHEADER_SIZE, MAXIMUM_SNAPLEN, pcap_linux::mmapbuf, pcap_linux::mmapbuflen, pcap::offset, pcap::opt, PCAP_ERRBUF_SIZE, PCAP_ERROR, PCAP_ERROR_PERM_DENIED, pcap_fmt_errmsg_for_errno(), pcap_strlcpy(), PCAP_TSTAMP_ADAPTER, PCAP_TSTAMP_ADAPTER_UNSYNCED, PCAP_WARNING_TSTAMP_TYPE_NOTSUP, pcap::priv, RING_GET_CURRENT_FRAME, setsockopt(), SLL2_HDR_LEN, SLL_HDR_LEN, pcap::snapshot, snprintf(), pcap_linux::timeout, pcap_linux::tp_hdrlen, pcap_linux::tp_version, pcap_opt::tstamp_type, and VLAN_TAG_LEN.
Referenced by setup_mmapped().
|
static |
Definition at line 3295 of file pcap-linux.c.
References pcap::fd, pcap_linux::mmapbuf, pcap_linux::mmapbuflen, munmap(), pcap::priv, and setsockopt().
Referenced by create_ring(), and pcap_cleanup_linux().
|
static |
Definition at line 1176 of file pcap-linux.c.
References pcap::errbuf, errno, pcap::fd, getsockname(), pcap_linux::ifindex, PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), and pcap::priv.
Referenced by pcap_wait_for_frames_mmap().
|
static |
Definition at line 4641 of file pcap-linux.c.
Referenced by activate_pf_packet().
Definition at line 5178 of file pcap-linux.c.
References DLT_LINUX_SLL2, bpf_insn::k, pcap::linktype, SLL2_HDR_LEN, and SLL_HDR_LEN.
Referenced by fix_program().
|
static |
Definition at line 5109 of file pcap-linux.c.
References bpf_program::bf_insns, bpf_program::bf_len, BPF_ABS, BPF_CLASS, BPF_IND, BPF_LD, BPF_LDX, BPF_MODE, BPF_MSH, bpf_insn::code, pcap_linux::cooked, pcap::errbuf, errno, pcap::fcode, fix_offset(), PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), and pcap::priv.
Referenced by pcap_setfilter_linux().
|
static |
Definition at line 1522 of file pcap-linux.c.
References ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_IEEE802154, ARPHRD_IRDA, close(), errno, get_if_ioctl_socket(), ioctl(), is_wifi(), PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), PCAP_IF_CONNECTION_STATUS_CONNECTED, PCAP_IF_CONNECTION_STATUS_DISCONNECTED, PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE, PCAP_IF_LOOPBACK, PCAP_IF_WIRELESS, pcap_strlcpy(), and snprintf().
Referenced by pcap_platform_finddevs().
|
static |
Definition at line 1402 of file pcap-linux.c.
References close(), errno, ioctl(), and socket().
Referenced by get_if_flags().
|
static |
Definition at line 4446 of file pcap-linux.c.
References bind(), errno, getsockopt(), PCAP_ERRBUF_SIZE, PCAP_ERROR, PCAP_ERROR_IFACE_NOT_UP, PCAP_ERROR_NO_SUCH_DEVICE, and pcap_fmt_errmsg_for_errno().
Referenced by activate_pf_packet(), and pcap_activate_linux().
|
static |
Definition at line 4992 of file pcap-linux.c.
References close(), DLT_EN10MB, dsa_protos, pcap::errbuf, errno, pcap::linktype, dsa_proto::linktype, PCAP_ERRBUF_SIZE, PCAP_ERROR, pcap_fmt_errmsg_for_errno(), read(), and snprintf().
Referenced by map_arphrd_to_dlt().
|
static |
Definition at line 5084 of file pcap-linux.c.
References errno, ioctl(), PCAP_ERRBUF_SIZE, PCAP_ERROR, PCAP_ERROR_NO_SUCH_DEVICE, pcap_fmt_errmsg_for_errno(), and pcap_strlcpy().
Referenced by activate_pf_packet().
|
static |
Definition at line 4425 of file pcap-linux.c.
References errno, ioctl(), PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), and pcap_strlcpy().
Referenced by activate_pf_packet().
|
static |
Definition at line 5061 of file pcap-linux.c.
References BIGGER_THAN_ALL_MTUS, errno, ioctl(), PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), and pcap_strlcpy().
Referenced by create_ring().
|
static |
Definition at line 4965 of file pcap-linux.c.
Referenced by create_ring().
|
static |
Definition at line 2718 of file pcap-linux.c.
References pcap::errbuf, errno, pcap::fd, getsockopt(), PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), pcap::priv, setsockopt(), snprintf(), pcap_linux::tp_hdrlen, and pcap_linux::tp_version.
Referenced by prepare_tpacket_socket().
|
static |
Definition at line 1738 of file pcap-linux.c.
References stat.
Referenced by get_if_flags(), and map_arphrd_to_dlt().
|
inlinestatic |
Definition at line 1123 of file pcap-linux.c.
References pcap::direction, LINUX_SLL_P_CAN, LINUX_SLL_P_CANFD, pcap_linux::lo_ifindex, PCAP_D_IN, PCAP_D_OUT, and pcap::priv.
Referenced by pcap_handle_packet_mmap().
|
static |
Definition at line 751 of file pcap-linux.c.
References close(), read(), snprintf(), and stat.
Referenced by linux_if_drops().
|
static |
Definition at line 771 of file pcap-linux.c.
References linux_get_stat().
Referenced by pcap_activate_linux(), and pcap_stats_linux().
|
static |
Definition at line 1780 of file pcap-linux.c.
References ARPHRD_ATM, ARPHRD_CAN, ARPHRD_CISCO, ARPHRD_DLCI, ARPHRD_FCAL, ARPHRD_FCFABRIC, ARPHRD_FCPL, ARPHRD_FCPP, ARPHRD_FDDI, ARPHRD_FRAD, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_IEEE802154, ARPHRD_IEEE802_TR, ARPHRD_IRDA, ARPHRD_LAPD, ARPHRD_NETLINK, ARPHRD_NONE, ARPHRD_RAWHDLC, ARPHRD_SIT, ARPHRD_VSOCKMON, DLT_ARCNET_LINUX, DLT_AX25_KISS, DLT_C_HDLC, DLT_CHAOS, pcap::dlt_count, DLT_DOCSIS, DLT_EN10MB, DLT_EN3MB, DLT_FC_2, DLT_FC_2_WITH_FRAME_DELIMS, DLT_FDDI, DLT_FRELAY, DLT_IEEE802, DLT_IEEE802_11, DLT_IEEE802_11_RADIO, DLT_IEEE802_15_4_NOFCS, DLT_IP_OVER_FC, DLT_LINUX_IRDA, DLT_LINUX_LAPD, DLT_LINUX_SLL, pcap::dlt_list, DLT_LTALK, DLT_NETLINK, DLT_PRISM_HEADER, DLT_PRONET, DLT_RAW, DLT_VSOCK, iface_dsa_get_proto_info(), is_wifi(), pcap::linktype, and pcap::offset.
Referenced by activate_pf_packet().
|
static |
Definition at line 959 of file pcap-linux.c.
References activate_pf_packet(), pcap::breakloop_op, pcap::cleanup_op, pcap_opt::device, pcap_linux::device, pcap::errbuf, errno, pcap::fd, pcap::getnonblock_op, iface_bind(), pcap_linux::ifindex, pcap::inject_op, linux_if_drops(), MAXIMUM_SNAPLEN, pcap::oneshot_callback, pcap::opt, pcap_breakloop_linux(), pcap_cleanup_linux(), PCAP_ERRBUF_SIZE, PCAP_ERROR, PCAP_ERROR_NO_SUCH_DEVICE, pcap_fmt_errmsg_for_errno(), pcap_getnonblock_linux(), pcap_inject_linux(), pcap_oneshot_linux(), pcap_protocol(), pcap_read_linux_mmap_v2(), pcap_set_datalink_linux(), pcap_setdirection_linux(), pcap_setfilter_linux(), pcap_setnonblock_linux(), pcap_stats_linux(), PCAP_WARNING_PROMISC_NOTSUP, pcap::priv, pcap_opt::promisc, pcap::read_op, pcap::selectable_fd, pcap::set_datalink_op, pcap::setdirection_op, pcap::setfilter_op, pcap::setnonblock_op, setup_mmapped(), pcap::snapshot, snprintf(), pcap::stats_op, pcap_linux::sysfs_dropped, pcap_opt::timeout, pcap_linux::timeout, and pcap_linux::tp_version.
Referenced by pcap_create_interface().
|
static |
Definition at line 940 of file pcap-linux.c.
References pcap_breakloop_common(), pcap_linux::poll_breakloop_fd, pcap::priv, and write().
Referenced by pcap_activate_linux().
|
static |
Definition at line 709 of file pcap-linux.c.
References pcap_opt::device, and pcap::opt.
Referenced by pcap_create_interface().
|
static |
Definition at line 789 of file pcap-linux.c.
References close(), destroy_ring(), pcap_linux::device, pcap::errbuf, pcap::fd, pcap_linux::mondevice, MUST_DELETE_MONIF, pcap_linux::must_do_on_close, pcap_linux::oneshot_buffer, pcap_cleanup_live_common(), pcap_remove_from_pcaps_to_close(), pcap_linux::poll_breakloop_fd, and pcap::priv.
Referenced by pcap_activate_linux().
pcap_t* pcap_create_interface | ( | const char * | device, |
char * | ebuf | ||
) |
Definition at line 340 of file pcap-linux.c.
References pcap::activate_op, pcap::can_set_rfmon_op, errno, pcap_activate_linux(), pcap_can_set_rfmon_linux(), pcap_close(), PCAP_CREATE_COMMON, PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), PCAP_TSTAMP_PRECISION_MICRO, PCAP_TSTAMP_PRECISION_NANO, pcap_linux::poll_breakloop_fd, pcap::priv, pcap::tstamp_precision_count, and pcap::tstamp_precision_list.
|
inlinestatic |
Definition at line 3395 of file pcap-linux.c.
References __atomic_load_n, thdr::h2, pcap::priv, thdr::raw, RING_GET_FRAME_AT, and pcap_linux::tp_version.
Referenced by pcap_setfilter_linux().
|
static |
Definition at line 3349 of file pcap-linux.c.
References pcap::priv, and pcap_linux::timeout.
Referenced by pcap_activate_linux().
|
static |
Definition at line 3757 of file pcap-linux.c.
References bpf_program::bf_insns, pcap::bufsize, pcap_pkthdr::caplen, pcap_linux::cooked, DLT_LINUX_SLL2, pcap::errbuf, pcap::fcode, pcap_linux::filter_in_userland, pcap_pkthdr::len, pcap::linktype, linux_check_direction(), PCAP_ERRBUF_SIZE, pcap_filter_with_aux_data(), pcap::priv, sll2_header::sll2_addr, sll2_header::sll2_halen, sll2_header::sll2_hatype, SLL2_HDR_LEN, sll2_header::sll2_if_index, sll2_header::sll2_pkttype, sll2_header::sll2_protocol, sll2_header::sll2_reserved_mbz, sll_header::sll_addr, SLL_ADDRLEN, sll_header::sll_halen, sll_header::sll_hatype, SLL_HDR_LEN, sll_header::sll_pkttype, sll_header::sll_protocol, pcap::snapshot, snprintf(), pcap_linux::tp_hdrlen, pcap_pkthdr::ts, pcap_linux::vlan_offset, pcap_bpf_aux_data::vlan_tag, VLAN_TAG_LEN, pcap_bpf_aux_data::vlan_tag_present, vlan_tag::vlan_tci, and vlan_tag::vlan_tpid.
Referenced by pcap_read_linux_mmap_v2().
|
static |
Definition at line 1217 of file pcap-linux.c.
References pcap_linux::cooked, pcap::errbuf, errno, pcap::fd, pcap_linux::ifindex, PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), pcap_strlcpy(), pcap::priv, and send().
Referenced by pcap_activate_linux().
const char* pcap_lib_version | ( | void | ) |
Definition at line 5428 of file pcap-linux.c.
References PCAP_VERSION_STRING.
|
static |
Definition at line 3336 of file pcap-linux.c.
References pcap_pkthdr::caplen, oneshot_userdata::hdr, pcap_linux::oneshot_buffer, oneshot_userdata::pd, oneshot_userdata::pkt, and pcap::priv.
Referenced by pcap_activate_linux().
int pcap_platform_finddevs | ( | pcap_if_list_t * | devlistp, |
char * | errbuf | ||
) |
Definition at line 1699 of file pcap-linux.c.
References add_dev(), any_descr, can_be_bound(), get_if_flags(), pcap_findalldevs_interfaces(), PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE, PCAP_IF_RUNNING, and PCAP_IF_UP.
|
static |
Definition at line 697 of file pcap-linux.c.
References pcap::opt.
Referenced by pcap_activate_linux().
|
static |
Definition at line 3984 of file pcap-linux.c.
References pcap_linux::blocks_to_filter_in_userland, pcap::break_loop, pcap::cc, pcap_linux::filter_in_userland, thdr::h2, pcap::offset, pcap::opt, PACKET_COUNT_IS_UNLIMITED, packet_mmap_acquire, packet_mmap_release, PCAP_ERROR_BREAK, pcap_handle_packet_mmap(), PCAP_TSTAMP_PRECISION_NANO, pcap_wait_for_frames_mmap(), pcap::priv, thdr::raw, RING_GET_CURRENT_FRAME, pcap_opt::tstamp_precision, VLAN_TPID, and VLAN_VALID.
Referenced by pcap_activate_linux().
|
static |
Definition at line 1111 of file pcap-linux.c.
References pcap::linktype.
Referenced by pcap_activate_linux().
int pcap_set_protocol_linux | ( | pcap_t * | p, |
int | protocol | ||
) |
Definition at line 5416 of file pcap-linux.c.
References pcap::opt, pcap_check_activated(), and PCAP_ERROR_ACTIVATED.
|
static |
Definition at line 1727 of file pcap-linux.c.
References pcap::direction.
Referenced by pcap_activate_linux().
|
static |
Definition at line 4196 of file pcap-linux.c.
References bpf_program::bf_len, pcap_linux::blocks_to_filter_in_userland, pcap::cc, pcap::errbuf, errno, pcap::fcode, pcap_linux::filter_in_userland, fix_program(), install_bpf_program(), pcap::offset, PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), pcap_get_ring_frame_status(), pcap_strerror(), pcap_strlcpy(), pcap::priv, reset_kernel_filter(), and set_kernel_filter().
Referenced by pcap_activate_linux().
|
static |
Definition at line 3358 of file pcap-linux.c.
References pcap_setnonblock_fd(), pcap::priv, set_poll_timeout(), and pcap_linux::timeout.
Referenced by pcap_activate_linux().
Definition at line 1259 of file pcap-linux.c.
References pcap_linux::device, pcap::errbuf, errno, pcap::fd, getsockopt(), linux_if_drops(), pcap::opt, PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), pcap::priv, pcap_opt::promisc, pcap_stat::ps_drop, pcap_stat::ps_ifdrop, pcap_stat::ps_recv, pcap_linux::stat, and pcap_linux::sysfs_dropped.
Referenced by pcap_activate_linux().
|
static |
Definition at line 3418 of file pcap-linux.c.
References pcap::break_loop, pcap_linux::device, device_still_exists(), pcap::errbuf, errno, pcap::fd, getsockopt(), ioctl(), pcap_linux::netdown, netdown_timeout, PCAP_ERRBUF_SIZE, PCAP_ERROR, PCAP_ERROR_BREAK, pcap_fmt_errmsg_for_errno(), pcap_strlcpy(), pcap_linux::poll_breakloop_fd, pcap_linux::poll_timeout, pcap::priv, read(), pcap::required_select_timeout, snprintf(), and pcap_linux::timeout.
Referenced by pcap_read_linux_mmap_v2().
|
static |
Definition at line 2786 of file pcap-linux.c.
References pcap::errbuf, pcap_opt::immediate, init_tpacket(), pcap::opt, PCAP_ERRBUF_SIZE, and snprintf().
Referenced by setup_mmapped().
|
static |
Definition at line 5390 of file pcap-linux.c.
References errno, pcap::fd, and setsockopt().
Referenced by pcap_setfilter_linux(), and set_kernel_filter().
|
static |
Definition at line 2268 of file pcap-linux.c.
Referenced by activate_pf_packet().
|
static |
Definition at line 5263 of file pcap-linux.c.
References pcap::errbuf, errno, pcap::fd, PCAP_ERRBUF_SIZE, pcap_fmt_errmsg_for_errno(), recv(), reset_kernel_filter(), setsockopt(), and total_fcode.
Referenced by pcap_setfilter_linux().
|
static |
Definition at line 894 of file pcap-linux.c.
References pcap_linux::poll_timeout, pcap_linux::timeout, and pcap_linux::tp_version.
Referenced by pcap_setnonblock_linux(), and setup_mmapped().
|
static |
Definition at line 2657 of file pcap-linux.c.
References pcap_opt::buffer_size, create_ring(), pcap::errbuf, errno, pcap_linux::oneshot_buffer, pcap::opt, PCAP_ERRBUF_SIZE, PCAP_ERROR, pcap_fmt_errmsg_for_errno(), prepare_tpacket_socket(), pcap::priv, set_poll_timeout(), and pcap::snapshot.
Referenced by pcap_activate_linux().
|
static |
Definition at line 1387 of file pcap-linux.c.
Referenced by pcap_platform_finddevs().
|
static |
Referenced by iface_dsa_get_proto_info().
|
static |
Definition at line 255 of file pcap-linux.c.
Referenced by pcap_wait_for_frames_mmap().
|
static |
Definition at line 330 of file pcap-linux.c.
Referenced by set_kernel_filter().
|
static |
Definition at line 330 of file pcap-linux.c.
Referenced by pcap_activate_bpf(), and pcap_activate_npf().