summaryrefslogtreecommitdiff
path: root/pcap-dag.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Use pcap_close() if pcap_create_handle() fails.Guy Harris2015-05-041-3/+1
| | | | | | | Use it to free up all memory attached to the pcap_t, as well as the pcap_t itself; that closes some memory leaks. Fixes GitHub issue #432.
* Delete trailing spaces/tabsFrancois-Xavier Le Bail2015-03-081-48/+48
|
* Remove advertising of tstamp_type sinc we don't support setting this.sfd2014-09-081-20/+0
| | | | A new API for advertising/recording reference clock sources and synchronisation state may be available in future.
* Added descrpitions to pcap_add_if() for DAG devices using dag_device_name() ↵sfd2014-09-011-2/+8
| | | | from dagpci.h.
* dag-pcap was not correctly handling ERF records with extension headers.sfd2014-08-261-3/+11
| | | | It was subtracting the extension header count from caplen after reducing it to packet_len, resulting in truncated records.
* Update contact detailssfd2014-07-291-4/+4
|
* Add dag support for pcap_*_tstamp_type() and pcap_*_tstamp_precision()sfd2014-07-291-3/+54
|
* remove libpcap's own CVS keywordsDenis Ovsienko2014-01-031-5/+0
| | | | | | This change removes CVS keywords that express that the file belongs to libpcap repository. All such keywords represented the revision and timestamp by the end of 2008 or even older.
* Add a PACKET_COUNT_IS_UNLIMITED() to test for a packet count <= 0.Guy Harris2013-12-141-1/+1
| | | | | | | | | | | | In read routines, a packet count <= 0 means "keep supplying packets until you run out of packets in the buffer", and it means "keep supply packets until the loop is broken out of or you get an error" in pcap_loop(). Use the macro in all tests for that, so the right test is always done (i.e., a count of 0 means "unlimited", not "supply zero packets"); this fixes some cases where we weren't doing the right test (and hopefully encourages programmers to use it and get the test right in new modules).
* Add stream support to dag_create()sfd2013-08-161-6/+25
| | | | | | DAG capture device names are of the format dagN or dagN:M where N is the device number and M is the stream number. The former implies stream 0.
* Rename the "private" member of a pcap_t to avoid C++ issues.Guy Harris2013-08-071-6/+6
| | | | | "private" is a C++ keyword; rename the "private" member of a pcap_t to "priv" to avoid that, as per Gisle Vanem's suggestion.
* Add an API to set "immediate mode".Guy Harris2013-05-081-5/+12
| | | | In "immediate mode", packets are delivered as soon as they arrive.
* Fencepost error.sfd2013-05-061-1/+1
| | | | If an ERF record has 0 'payload' bytes the last extension header will not be counted and the header length will be calculated incorrectly.
* Move platform-dependent pcap_t data out of the pcap_t structure.Guy Harris2013-05-061-56/+84
| | | | | | | | | | | | | | | Put the private data right after the pcap_t structure, with a pointer to it in the pcap_t. The initial goal is to allow new pcap modules to be added without having to hack pcap-int.h. In the longer term, we may want to freeze the pcap_t structure, except possibly for adding new method pointers at the end, and provide an ABI for adding modules. We also put the stuff used by the read path at the beginning of the pcap_t structure, to try to keep it on the same set of cache lines.
* And un-constify some others.Guy Harris2012-06-111-1/+2
|
* Constify some variables.Guy Harris2012-06-111-1/+1
|
* Have non-interface modules take responsibility for identifying their devices.Guy Harris2012-06-111-13/+39
| | | | | | | | | | | | | | Have a table of routines to do pcap_create() for devices that aren't regular network interfaces. Try each of those in succession until one says "it's mine" (whether it succeeds or fails); if none do, do a pcap_create() for a regular interface. Have those routines do more stringent tests of the name - don't just accept any name that has a particular substring anywhere in it. That reduces the likelihood of a false match (as happened with the CANbus module when somebody renamed their Ethernet interface "canopy"). Have the table also include routines for pcap_findalldevs().
* Improve dag_platform_finddevs range and efficiency.Stephen Donnelly2009-10-131-3/+8
| | | | | | | | Find dags 0-31 instead of 0-9. Find streams up to DAG_MAX_STREAMS (currently 64) not 16. Use rxstreams count to reduce number of test attaches required.
* handle->md.stat should be zeroed out when we initially allocated theGuy Harris2009-09-071-0/+1
| | | | | pcap_t, but, as long as we're initializing ps_drop and ps_recv, initialize ps_ifdrop.
* Updating Endace DAG ERF support.Stephen Donnelly2009-05-041-2/+17
| | | | | | | | | | - Ensure all 'MC' ERF types are handled correctly by DLT_ERF. - Allow capture of ERF 'TYPE_IPV6' records as DLT_RAW. - Add new ERF types - Explicitly list known ERF types with no matching native DLT.
* Turn close_op into cleanup_op; the routine that handles it can also beguy2008-04-141-7/+12
| | | | | | | | | | | | | | | | | | | | | | | used to clean up after a failed pcap_activate() call. Convert the existing close_op routines to cleanup_op routines, and use them to clean up; rename pcap_close_common() to pcap_cleanup_live_common(), and use it directly if there's no platform-dependent cleanup needed. That means we don't have to write the same cleanup code twice (and possibly forget stuff in the version done on a failed pcap_activate() call). Have the cleanup routines do whatever is necessary to indicate that cleanup has been done, and not do any particular cleaning up if it's already been done (i.e., don't free something if the pointer to it is null and null out the pointer once it's been freed, don't close an FD if it's -1 and set it to -1 once it's been closed, etc.). For device types/platforms where we don't support monitor mode, check for it and return PCAP_ERROR_RFMON_NOTSUP - but do so after we've checked whether we can open the device, so we return "no such device" or "permission denied" rather than "that device doesn't support monitor mode" if we can't open the device in the first place. Fix a comment.
* From Stephen Donnelly: fix some compile errors from the conversion toguy2008-04-081-8/+8
| | | | the create/activate mode.
* From Paolo Abeni and me: split pcap_open_live() into a "get a pcap_tguy2008-04-041-69/+51
| | | | | | | | | | | | | | | | handle" routine, an 'activate a pcap_t handle" routine, and some "set the properties of the pcap_t handle" routines, so that, for example, the buffer size can be set on a BPF device before the device is bound to an interface. Add additional routines to set monitor mode, and make at least an initial attempt at supporting that on Linux, *BSD, and Mac OS X 10.4 and 10.5. (Very much "initial" for Linux, which is a twisty little maze of wireless drivers, many different.) Have a "timeout" member of the pcap_md structure on all platforms, use that on Windows instead of the "timeout" member of the pcap_t structure, and get rid of the "timeout" member of that structure.
* Explicitly check for a positive "cnt" argument, as at least some otherguy2008-02-021-2/+2
| | | | | read_op loops do, to clarify that a zero or negative "cnt" value means "loop until we run out of packets".
* Fix a typo; this fixes bug 1854436.guy2008-01-061-2/+2
|
* From Stephen Donnelly:guy2007-11-091-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.
* From Stephen Donnelly:guy2007-11-051-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.
* From Stephen Donnelly:guy2007-10-301-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.
* From Stephen Donnelly:guy2007-10-041-38/+69
| | | | | | * Improved error checking in dag_read(). * More efficient dag_platform_finddevs(). * Support for new DAG API function dag_get_stream_erf_types().
* Based on work from Florent Drouin, split the 32-bit link-layer typeguy2007-09-291-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.
* From Stephen Donnelly of Endace:guy2007-06-221-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.
* From Florent Drouin: clean up resources when an open fails.guy2007-02-011-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".
* From Paolo Abeni:guy2007-01-291-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.
* From Stephen Donnelly: add support for new DAG ERF types.guy2006-09-251-2/+34
|
* From Stephen Donnelly:guy2006-04-071-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.
* Stephen Donnely says MTP3 and SCCP don't belong in the list of DLT_guy2005-07-101-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.
* From Stephen Donnelly: updates to the DAG support, to support theirguy2005-07-071-234/+359
| | | | updated API if available.
* From Pawel Pokrywka: add support for requesting that only receivedguy2005-05-031-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.
* "install_bpf_program()" already sets "p->errbuf" to an error string ifguy2005-04-031-5/+2
| | | | it fails; there's no need for "dag_setfilter()" to do so.
* From Koryn Grant:guy2005-01-211-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.
* From Koryn Grant:guy2004-11-101-21/+6
| | | | | | | correctly detect a rare error condition and return a sensible error message instead of blindly continuing; clean up some endian-specific code.
* Add support for sending packets; includes contributions from Markguy2004-03-231-1/+10
| | | | Pizzolato <List-tcpdump-workers@subscriptions.pizzolato.net>.
* From Jesper Peterson: fix a couple of endianness problems.guy2004-01-301-6/+6
|
* From Jesper Peterson:guy2004-01-051-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.
* For devices that we have some reason to believe are real live Ethernetguy2003-12-181-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.
* Add a "pcap_get_selectable_fd()" API to get an FD on which you can do aguy2003-11-211-1/+6
| | | | "select()" or "poll()" - or -1 if that won't work.
* Add "getnonblock" and "setnonblock" operations, and set the functionguy2003-11-201-1/+24
| | | | | | | pointers appropriately, rather than using #ifdefs and run-time checks. Get rid of declaration of non-existent "pcap_set_datalink_platform()" routine.
* From Koryn Grant <koryn@endace.com> - DAG support enhancements and fixes:guy2003-11-201-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.
* Add _U_ to "rcsid[]" definitions, to eliminate "unused variable"guy2003-11-151-2/+2
| | | | warnings from newer versions of GCC.
* Add a "pcap_breakloop()" API to break out of the loop inguy2003-11-041-3/+16
| | | | "pcap_dispatch()" and "pcap_loop()".