xref: /aosp_15_r20/external/libpcap/doc/README.dag (revision 8b26181f966a6af5cf6981a6f474313de533bb28)
1*8b26181fSAndroid Build Coastguard Worker
2*8b26181fSAndroid Build Coastguard WorkerThe following instructions apply if you have a Linux or FreeBSD platform and
3*8b26181fSAndroid Build Coastguard Workerwant libpcap to support the DAG range of passive network monitoring cards from
4*8b26181fSAndroid Build Coastguard WorkerEndace (https://www.endace.com, see below for further contact details).
5*8b26181fSAndroid Build Coastguard Worker
6*8b26181fSAndroid Build Coastguard Worker1) Install and build the DAG software distribution by following the
7*8b26181fSAndroid Build Coastguard Workerinstructions supplied with that package. Current Endace customers can download
8*8b26181fSAndroid Build Coastguard Workerthe DAG software distribution from https://www.endace.com
9*8b26181fSAndroid Build Coastguard Worker
10*8b26181fSAndroid Build Coastguard Worker2) Configure libcap. To allow the 'configure' script to locate the DAG
11*8b26181fSAndroid Build Coastguard Workersoftware distribution use the '--with-dag' option:
12*8b26181fSAndroid Build Coastguard Worker
13*8b26181fSAndroid Build Coastguard Worker        ./configure --with-dag=DIR
14*8b26181fSAndroid Build Coastguard Worker
15*8b26181fSAndroid Build Coastguard WorkerWhere DIR is the root of the DAG software distribution, for example
16*8b26181fSAndroid Build Coastguard Worker/var/src/dag. If the DAG software is correctly detected 'configure' will
17*8b26181fSAndroid Build Coastguard Workerreport:
18*8b26181fSAndroid Build Coastguard Worker
19*8b26181fSAndroid Build Coastguard Worker        checking whether we have DAG API... yes
20*8b26181fSAndroid Build Coastguard Worker
21*8b26181fSAndroid Build Coastguard WorkerIf 'configure' reports that there is no DAG API, the directory may have been
22*8b26181fSAndroid Build Coastguard Workerincorrectly specified or the DAG software was not built before configuring
23*8b26181fSAndroid Build Coastguard Workerlibpcap.
24*8b26181fSAndroid Build Coastguard Worker
25*8b26181fSAndroid Build Coastguard WorkerSee also the libpcap INSTALL.md file for further libpcap configuration
26*8b26181fSAndroid Build Coastguard Workeroptions.
27*8b26181fSAndroid Build Coastguard Worker
28*8b26181fSAndroid Build Coastguard WorkerBuilding libpcap at this stage will include support for both the native packet
29*8b26181fSAndroid Build Coastguard Workercapture stream (linux or bpf) and for capturing from DAG cards. To build
30*8b26181fSAndroid Build Coastguard Workerlibpcap with only DAG support specify the capture type as 'dag' when
31*8b26181fSAndroid Build Coastguard Workerconfiguring libpcap:
32*8b26181fSAndroid Build Coastguard Worker
33*8b26181fSAndroid Build Coastguard Worker        ./configure --with-dag=DIR --with-pcap=dag
34*8b26181fSAndroid Build Coastguard Worker
35*8b26181fSAndroid Build Coastguard WorkerApplications built with libpcap configured in this way will only detect DAG
36*8b26181fSAndroid Build Coastguard Workercards and will not capture from the native OS packet stream.
37*8b26181fSAndroid Build Coastguard Worker
38*8b26181fSAndroid Build Coastguard Worker----------------------------------------------------------------------
39*8b26181fSAndroid Build Coastguard Worker
40*8b26181fSAndroid Build Coastguard WorkerLibpcap when built for DAG cards against dag-2.5.1 or later releases:
41*8b26181fSAndroid Build Coastguard Worker
42*8b26181fSAndroid Build Coastguard WorkerTimeouts are supported. pcap_dispatch() will return after to_ms milliseconds
43*8b26181fSAndroid Build Coastguard Workerregardless of how many packets are received. If to_ms is zero pcap_dispatch()
44*8b26181fSAndroid Build Coastguard Workerwill block waiting for data indefinitely.
45*8b26181fSAndroid Build Coastguard Worker
46*8b26181fSAndroid Build Coastguard Workerpcap_dispatch() will block on and process a minimum of 64kB of data (before
47*8b26181fSAndroid Build Coastguard Workerfiltering) for efficiency. This can introduce high latencies on quiet
48*8b26181fSAndroid Build Coastguard Workerinterfaces unless a timeout value is set. The timeout expiring will override
49*8b26181fSAndroid Build Coastguard Workerthe 64kB minimum causing pcap_dispatch() to process any available data and
50*8b26181fSAndroid Build Coastguard Workerreturn.
51*8b26181fSAndroid Build Coastguard Worker
52*8b26181fSAndroid Build Coastguard Workerpcap_setnonblock is supported. When nonblock is set, pcap_dispatch() will
53*8b26181fSAndroid Build Coastguard Workercheck once for available data, process any data available up to count, then
54*8b26181fSAndroid Build Coastguard Workerreturn immediately.
55*8b26181fSAndroid Build Coastguard Worker
56*8b26181fSAndroid Build Coastguard Workerpcap_findalldevs() is supported, e.g. dag0, dag1...
57*8b26181fSAndroid Build Coastguard Worker
58*8b26181fSAndroid Build Coastguard WorkerSome DAG cards can provide more than one 'stream' of received data.
59*8b26181fSAndroid Build Coastguard WorkerThis can be data from different physical ports, or separated by filtering
60*8b26181fSAndroid Build Coastguard Workeror load balancing mechanisms. Receive streams have even numbers, e.g.
61*8b26181fSAndroid Build Coastguard Workerdag0:0, dag0:2 etc. Specifying transmit streams for capture is not supported.
62*8b26181fSAndroid Build Coastguard Worker
63*8b26181fSAndroid Build Coastguard Workerpcap_setfilter() is supported, BPF programs run in userspace.
64*8b26181fSAndroid Build Coastguard Worker
65*8b26181fSAndroid Build Coastguard Workerpcap_setdirection() is not supported. Only received traffic is captured.
66*8b26181fSAndroid Build Coastguard WorkerDAG cards normally do not have IP or link layer addresses assigned as
67*8b26181fSAndroid Build Coastguard Workerthey are used to passively monitor links.
68*8b26181fSAndroid Build Coastguard Worker
69*8b26181fSAndroid Build Coastguard Workerpcap_breakloop() is supported.
70*8b26181fSAndroid Build Coastguard Worker
71*8b26181fSAndroid Build Coastguard Workerpcap_datalink() and pcap_list_datalinks() are supported. The DAG card does
72*8b26181fSAndroid Build Coastguard Workernot attempt to set the correct datalink type automatically where more than
73*8b26181fSAndroid Build Coastguard Workerone type is possible.
74*8b26181fSAndroid Build Coastguard Worker
75*8b26181fSAndroid Build Coastguard Workerpcap_stats() is supported. ps_drop is the number of packets dropped due to
76*8b26181fSAndroid Build Coastguard WorkerRX stream buffer overflow, this count is before filters are applied (it will
77*8b26181fSAndroid Build Coastguard Workerinclude packets that would have been dropped by the filter). The RX stream
78*8b26181fSAndroid Build Coastguard Workerbuffer size is user configurable outside libpcap, typically 16-512MB.
79*8b26181fSAndroid Build Coastguard Worker
80*8b26181fSAndroid Build Coastguard Workerpcap_get_selectable_fd() is not supported, as DAG cards do not support
81*8b26181fSAndroid Build Coastguard Workerpoll/select methods.
82*8b26181fSAndroid Build Coastguard Worker
83*8b26181fSAndroid Build Coastguard Workerpcap_inject() and pcap_sendpacket() are not supported.
84*8b26181fSAndroid Build Coastguard Worker
85*8b26181fSAndroid Build Coastguard WorkerSome DAG cards now support capturing to multiple virtual interfaces, called
86*8b26181fSAndroid Build Coastguard Workerstreams. Capture streams have even numbers. These are available via libpcap
87*8b26181fSAndroid Build Coastguard Workeras separate interfaces, e.g. dag0:0, dag0:2, dag0:4 etc. dag0:0 is the same
88*8b26181fSAndroid Build Coastguard Workeras dag0. These are visible via pcap_findalldevs().
89*8b26181fSAndroid Build Coastguard Worker
90*8b26181fSAndroid Build Coastguard Workerlibpcap now does NOT set the card's hardware snaplen (slen). This must now be
91*8b26181fSAndroid Build Coastguard Workerset using the appropriate DAG configuration program, e.g. dagthree, dagfour,
92*8b26181fSAndroid Build Coastguard Workerdagsix, dagconfig. This is because the snaplen is currently shared between
93*8b26181fSAndroid Build Coastguard Workerall of the streams. In future this may change if per-stream slen is
94*8b26181fSAndroid Build Coastguard Workerimplemented.
95*8b26181fSAndroid Build Coastguard Worker
96*8b26181fSAndroid Build Coastguard WorkerDAG cards by default capture entire packets including the L2
97*8b26181fSAndroid Build Coastguard WorkerCRC/FCS. If the card is not configured to discard the CRC/FCS, this
98*8b26181fSAndroid Build Coastguard Workercan confuse applications that use libpcap if they're not prepared for
99*8b26181fSAndroid Build Coastguard Workerpackets to have an FCS.
100*8b26181fSAndroid Build Coastguard Worker
101*8b26181fSAndroid Build Coastguard WorkerLibpcap now reads the environment variable ERF_FCS_BITS to determine
102*8b26181fSAndroid Build Coastguard Workerhow many bits of CRC/FCS to strip from the end of the captured
103*8b26181fSAndroid Build Coastguard Workerframe. This defaults to 32 for use with Ethernet. If the card is
104*8b26181fSAndroid Build Coastguard Workerconfigured to strip the CRC/FCS, then set ERF_FCS_BITS=0. If used with
105*8b26181fSAndroid Build Coastguard Workera HDLC/PoS/PPP/Frame Relay link with 16 bit CRC/FCS, then set
106*8b26181fSAndroid Build Coastguard WorkerERF_FCS_BITS=16.
107*8b26181fSAndroid Build Coastguard Worker
108*8b26181fSAndroid Build Coastguard WorkerIf you wish to create a pcap file that DOES contain the Ethernet FCS,
109*8b26181fSAndroid Build Coastguard Workerspecify the environment variable ERF_DONT_STRIP_FCS. This will cause
110*8b26181fSAndroid Build Coastguard Workerthe existing FCS to be captured into the pcap file. Note some
111*8b26181fSAndroid Build Coastguard Workerapplications may incorrectly report capture errors or oversize packets
112*8b26181fSAndroid Build Coastguard Workerwhen reading these files.
113*8b26181fSAndroid Build Coastguard Worker
114*8b26181fSAndroid Build Coastguard Worker----------------------------------------------------------------------
115*8b26181fSAndroid Build Coastguard Worker
116*8b26181fSAndroid Build Coastguard WorkerPlease submit bug reports via <[email protected]>.
117*8b26181fSAndroid Build Coastguard Worker
118*8b26181fSAndroid Build Coastguard WorkerPlease also visit our Web site at:
119*8b26181fSAndroid Build Coastguard Worker
120*8b26181fSAndroid Build Coastguard Worker        https://www.endace.com/
121*8b26181fSAndroid Build Coastguard Worker
122*8b26181fSAndroid Build Coastguard WorkerFor more information about Endace DAG cards contact <[email protected]>.
123