JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1 | |
| 2 | The following instructions apply if you have a Linux or FreeBSD platform and |
| 3 | want libpcap to support the DAG range of passive network monitoring cards from |
| 4 | Endace (http://www.endace.com, see below for further contact details). |
| 5 | |
| 6 | 1) Install and build the DAG software distribution by following the |
| 7 | instructions supplied with that package. Current Endace customers can download |
| 8 | the DAG software distibution from https://www.endace.com |
| 9 | |
| 10 | 2) Configure libcap. To allow the 'configure' script to locate the DAG |
| 11 | software distribution use the '--with-dag' option: |
| 12 | |
| 13 | ./configure --with-dag=DIR |
| 14 | |
| 15 | Where DIR is the root of the DAG software distribution, for example |
| 16 | /var/src/dag. If the DAG software is correctly detected 'configure' will |
| 17 | report: |
| 18 | |
| 19 | checking whether we have DAG API... yes |
| 20 | |
| 21 | If 'configure' reports that there is no DAG API, the directory may have been |
| 22 | incorrectly specified or the DAG software was not built before configuring |
| 23 | libpcap. |
| 24 | |
| 25 | See also the libpcap INSTALL.txt file for further libpcap configuration |
| 26 | options. |
| 27 | |
| 28 | Building libpcap at this stage will include support for both the native packet |
| 29 | capture stream (linux or bpf) and for capturing from DAG cards. To build |
| 30 | libpcap with only DAG support specify the capture type as 'dag' when |
| 31 | configuring libpcap: |
| 32 | |
| 33 | ./configure --with-dag=DIR --with-pcap=dag |
| 34 | |
| 35 | Applications built with libpcap configured in this way will only detect DAG |
| 36 | cards and will not capture from the native OS packet stream. |
| 37 | |
| 38 | ---------------------------------------------------------------------- |
| 39 | |
| 40 | Libpcap when built for DAG cards against dag-2.5.1 or later releases: |
| 41 | |
| 42 | Timeouts are supported. pcap_dispatch() will return after to_ms milliseconds |
| 43 | regardless of how many packets are received. If to_ms is zero pcap_dispatch() |
| 44 | will block waiting for data indefinitely. |
| 45 | |
| 46 | pcap_dispatch() will block on and process a minimum of 64kB of data (before |
| 47 | filtering) for efficiency. This can introduce high latencies on quiet |
| 48 | interfaces unless a timeout value is set. The timeout expiring will override |
| 49 | the 64kB minimum causing pcap_dispatch() to process any available data and |
| 50 | return. |
| 51 | |
| 52 | pcap_setnonblock is supported. When nonblock is set, pcap_dispatch() will |
| 53 | check once for available data, process any data available up to count, then |
| 54 | return immediately. |
| 55 | |
| 56 | pcap_findalldevs() is supported, e.g. dag0, dag1... |
| 57 | |
| 58 | Some DAG cards can provide more than one 'stream' of received data. |
| 59 | This can be data from different physical ports, or separated by filtering |
| 60 | or load balancing mechanisms. Receive streams have even numbers, e.g. |
| 61 | dag0:0, dag0:2 etc. Specifying transmit streams for capture is not supported. |
| 62 | |
| 63 | pcap_setfilter() is supported, BPF programs run in userspace. |
| 64 | |
| 65 | pcap_setdirection() is not supported. Only received traffic is captured. |
| 66 | DAG cards normally do not have IP or link layer addresses assigned as |
| 67 | they are used to passively monitor links. |
| 68 | |
| 69 | pcap_breakloop() is supported. |
| 70 | |
| 71 | pcap_datalink() and pcap_list_datalinks() are supported. The DAG card does |
| 72 | not attempt to set the correct datalink type automatically where more than |
| 73 | one type is possible. |
| 74 | |
| 75 | pcap_stats() is supported. ps_drop is the number of packets dropped due to |
| 76 | RX stream buffer overflow, this count is before filters are applied (it will |
| 77 | include packets that would have been dropped by the filter). The RX stream |
| 78 | buffer size is user configurable outside libpcap, typically 16-512MB. |
| 79 | |
| 80 | pcap_get_selectable_fd() is not supported, as DAG cards do not support |
| 81 | poll/select methods. |
| 82 | |
| 83 | pcap_inject() and pcap_sendpacket() are not supported. |
| 84 | |
| 85 | Some DAG cards now support capturing to multiple virtual interfaces, called |
| 86 | streams. Capture streams have even numbers. These are available via libpcap |
| 87 | as separate interfaces, e.g. dag0:0, dag0:2, dag0:4 etc. dag0:0 is the same |
| 88 | as dag0. These are visible via pcap_findalldevs(). |
| 89 | |
| 90 | libpcap now does NOT set the card's hardware snaplen (slen). This must now be |
| 91 | set using the appropriate DAG coniguration program, e.g. dagthree, dagfour, |
| 92 | dagsix, dagconfig. This is because the snaplen is currently shared between |
| 93 | all of the streams. In future this may change if per-stream slen is |
| 94 | implemented. |
| 95 | |
| 96 | DAG cards by default capture entire packets including the L2 |
| 97 | CRC/FCS. If the card is not configured to discard the CRC/FCS, this |
| 98 | can confuse applications that use libpcap if they're not prepared for |
| 99 | packets to have an FCS. |
| 100 | |
| 101 | Libpcap now reads the environment variable ERF_FCS_BITS to determine |
| 102 | how many bits of CRC/FCS to strip from the end of the captured |
| 103 | frame. This defaults to 32 for use with Ethernet. If the card is |
| 104 | configured to strip the CRC/FCS, then set ERF_FCS_BITS=0. If used with |
| 105 | a HDLC/PoS/PPP/Frame Relay link with 16 bit CRC/FCS, then set |
| 106 | ERF_FCS_BITS=16. |
| 107 | |
| 108 | If you wish to create a pcap file that DOES contain the Ethernet FCS, |
| 109 | specify the environment variable ERF_DONT_STRIP_FCS. This will cause |
| 110 | the existing FCS to be captured into the pcap file. Note some |
| 111 | applications may incorrectly report capture errors or oversize packets |
| 112 | when reading these files. |
| 113 | |
| 114 | ---------------------------------------------------------------------- |
| 115 | |
| 116 | Please submit bug reports via <support@endace.com>. |
| 117 | |
| 118 | Please also visit our Web site at: |
| 119 | |
| 120 | http://www.endace.com/ |
| 121 | |
| 122 | For more information about Endace DAG cards contact <sales@endace.com>. |