aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-dag.c
AgeCommit message (Collapse)AuthorFilesLines
2007-11-09From Stephen Donnelly:guy1-29/+39
Changing the behaviour when the ERF type is unknown, and for ERF TYPE_PAD. Unknown ERF types can always be captured as DLT_ERF. TYPE_PAD records are dropped silently.
2007-11-05From Stephen Donnelly:guy1-62/+84
support ERF extension headers; collect the ifdefs for different ERF types into a header to improve readability; add in a couple of new types.
2007-10-30From Stephen Donnelly:guy1-96/+138
Clean up the configure output for the dag libraries a bit. Add Florent Drouin's changes for DLT_ERF. Some other DAG changes.
2007-10-04From Stephen Donnelly:guy1-38/+69
* Improved error checking in dag_read(). * More efficient dag_platform_finddevs(). * Support for new DAG API function dag_get_stream_erf_types().
2007-09-29Based on work from Florent Drouin, split the 32-bit link-layer typeguy1-14/+35
field in a capture file into: a 16-bit link-layer type field (it's 16 bits in pcap-NG, and that'll probably be enough for the foreseeable future); a 10-bit "class" field, indicating the group of link-layer type values to which the link-layer type belongs - class 0 is for regular DLT_ values, and class 0x224 grandfathers in the NetBSD "raw address family" link-layer types; a 6-bit "extension" field, storing information about the capture, such an indication of whether the packets include an FCS and, if so, how many bytes of FCS are present.
2007-06-22From Stephen Donnelly of Endace:guy1-1/+41
This patch introduces support for the DAG ERF type TYPE_COLOR_MC_HDLC_POS. The patch also allows appropriate DAG cards (DAG 3.7T, DAG 7.1S) to optionally produce DLT_MTP2_WITH_PHDR (139) traces when capturing from channelised HDLC links, as an alternative to DLT_MTP2 (140). When using the new DLT, the 'DAG channel' is recorded in the pcap record pseudo header as the 'link_number'. Basic BPF filtering support for DLT_MTP2_WITH_PHDR is also added. Fix some warnings.
2007-02-01From Florent Drouin: clean up resources when an open fails.guy1-35/+56
In addition, clean up the allocation and freeing of the temporary pathname string buffer. Also, there's no need to set "md.device" (it's only used on Linux, and even then used only with the old SOCK_PACKET sockets, where you have to turn promiscuous mode off explicitly rather than having it turn off automatically when you close the socket) or "md.timeout".
2007-01-29From Paolo Abeni:guy1-15/+2
The USB pseudo-header in DLT_USB_LINUX captures is in the host byte order for the machine on which the capture was done. When reading a capture file, convert the pseudo-header to the host byte order of the host on which the file is being read. There's a 64-bit quantity in that pseudo-header; move the 64-bit byte-swap macro from the DAG code to pcap-int.h for use by other code.
2006-09-25From Stephen Donnelly: add support for new DAG ERF types.guy1-2/+34
2006-04-07From Stephen Donnelly:guy1-72/+113
If the DAG API supports asking a card for the set of ERF types it supports, use that capability, to handle cards that support multiple ERF types. This is to support channelised/fractional T1/E1. Don't set the snapshot length - some DAG cards support multiple capture streams, but the snapshot length is global, so it'd affect other captures. Update README.dag.
2005-07-10Stephen Donnely says MTP3 and SCCP don't belong in the list of DLT_guy1-4/+2
values for an HDLC link (MTP2 is what's usually run on those links, with MTP3 atop it); remove them. Also, boost dlt_count to match the number of DLT_ values.
2005-07-07From Stephen Donnelly: updates to the DAG support, to support theirguy1-234/+359
updated API if available.
2005-05-03From Pawel Pokrywka: add support for requesting that only receivedguy1-1/+2
packets, only sent packets, or all packets be accepted, with an implementation for Linux. Add an implementation for BPF platforms that support BIOCSSEESENT.
2005-04-03"install_bpf_program()" already sets "p->errbuf" to an error string ifguy1-5/+2
it fails; there's no need for "dag_setfilter()" to do so.
2005-01-21From Koryn Grant:guy1-5/+14
The DAG 4.2 OC-48 cards (and revisions thereof) produce ERF records that do not contain the trailing FCS. However, pcap-dag.c assumed that there is an FCS and strips the final word of the packet. This meant that packets captured with libpcap on a DAG 4.2 are truncated by four bytes, unless a magical environment variable (ERF_FCS_BITS) was set. This patch autodetects when the DAG card is a 4.2, and turns off the FCS-stripping feature so that packets are no longer truncated. Also, include "dagnew.h" and "dagapi.h" with quotes, not angle brackets, as they should be in the user search path, not the system search path.
2004-11-10From Koryn Grant:guy1-21/+6
correctly detect a rare error condition and return a sensible error message instead of blindly continuing; clean up some endian-specific code.
2004-03-23Add support for sending packets; includes contributions from Markguy1-1/+10
Pizzolato <List-tcpdump-workers@subscriptions.pizzolato.net>.
2004-01-30From Jesper Peterson: fix a couple of endianness problems.guy1-6/+6
2004-01-05From Jesper Peterson:guy1-407/+438
- don't auto-detect HDLC DLT on serial links, use "pcap_set_datalink()" to choose the link-layer header - for ATM, allow selecting SUNATM rather than the default RFC1483 with "pcap_set_datalink()" - reformat and otherwise clean up the code.
2003-12-18For devices that we have some reason to believe are real live Ethernetguy1-14/+35
devices, offer DLT_DOCSIS as one of the choices of link-layer type, and support setting that type as meaning just "set libpcap's notion of the link-layer type to DLT_DOCSIS" without telling the driver to use DLT_DOCSIS.
2003-11-21Add a "pcap_get_selectable_fd()" API to get an FD on which you can do aguy1-1/+6
"select()" or "poll()" - or -1 if that won't work.
2003-11-20Add "getnonblock" and "setnonblock" operations, and set the functionguy1-1/+24
pointers appropriately, rather than using #ifdefs and run-time checks. Get rid of declaration of non-existent "pcap_set_datalink_platform()" routine.
2003-11-20From Koryn Grant <koryn@endace.com> - DAG support enhancements and fixes:guy1-155/+220
Added support for nonblocking operation. Added support for processing more than a single packet in pcap_dispatch(). Fixed bug in loss counter code. Improved portability of loss counter code (e.g. use UINT_MAX instead of 0xffff). Removed unused local variables. Added required headers (ctype.h, limits.h, unistd.h, netinet/in.h). Changed semantics to match those of standard pcap on linux. - packets rejected by the filter are not counted.
2003-11-15Add _U_ to "rcsid[]" definitions, to eliminate "unused variable"guy1-2/+2
warnings from newer versions of GCC.
2003-11-04Add a "pcap_breakloop()" API to break out of the loop inguy1-3/+16
"pcap_dispatch()" and "pcap_loop()".
2003-10-02From Jesper Peterson:guy1-12/+16
Fix the pcap-dag atexit() handler for non-execing child processes. Previously a fork()/exit() would stop the packet capture (doh!). Add a couple of optimizations.
2003-08-18From Jesper Peterson: for HDLC packet-over-SONET DAG captures, don'tguy1-25/+51
assume Cisco HDLC, look at the first frame to see whether it has a PPP-in-HDLC-like-frameing header, and use DLT_PPP_SERIAL for that and DLT_CHDLC otherwise.
2003-07-25Updates from Jesper Peterson.guy1-43/+81
2003-07-25Add a "read" function pointer to the pcap_t structure, which handlesguy1-4/+3
reading packets from a pcap_t, and make "pcap_read()" call it. That removes the last place where we have to check for a pcap_t that refers to a DAG card rather than a live capture, so get rid of the "is_dag" flag.
2003-07-25Add a "set_datalink" function pointer to the pcap_t structure, whichhandlesguy1-4/+5
setting a filter for a pcap_t. Have "pcap_set_datalink()" call it, rather than explicitly calling "pcap_set_datalink_platform()".
2003-07-25Add a "setfilter" function pointer to the pcap_t structure, whichguy1-4/+4
handles setting a filter for a pcap_t. Have "pcap_setfilter()" call it, rather than being a per-platform function. The per-platform functions don't need to check for an offline capture any more, as they're not called for an offline capture (and the ones that just call "install_bpf_program()" don't need to exist at all).
2003-07-25Add a "stats" function pointer to the pcap_t structure, which handlesguy1-2/+5
getting statistics for a pcap_t. Have "pcap_stats()" call it, rather than being a per-platform function; have stats routines for non-live pcap_t's that return an error.
2003-07-25Add a "close" function pointer to the pcap_t structure, which handlesguy1-7/+10
the platform-dependent part of closing a pcap_t (and the live-vs-savefile part as well, so that function must close the file descriptor and free up any buffers allocated). In the Digital UNIX support, add in a check for a memory allocation failure.
2003-07-23From Jesper Peterson <jesper@endace.com>: support for capturing fromguy1-0/+530
Endace DAG devices.