blob: d89e3bb62b6971ce3cf287ebd166cbc3f76267ad [file] [log] [blame] [view]
Elliott Hughes773b27c2021-08-20 17:37:36 -07001# LIBPCAP 1.x.y by [The Tcpdump Group](https://www.tcpdump.org)
The Android Open Source Project478ab6c2009-03-03 19:30:05 -08002
Elliott Hughes773b27c2021-08-20 17:37:36 -07003**To report a security issue please send an e-mail to security@tcpdump.org.**
Haibo Huangee759ce2021-01-05 21:34:29 -08004
5To report bugs and other problems, contribute patches, request a
Elliott Hughes773b27c2021-08-20 17:37:36 -07006feature, provide generic feedback etc please see the
7[guidelines for contributing](CONTRIBUTING.md).
Haibo Huangee759ce2021-01-05 21:34:29 -08008
Elliott Hughes773b27c2021-08-20 17:37:36 -07009The [documentation directory](doc/) has README files about specific
10operating systems and options.
Haibo Huangee759ce2021-01-05 21:34:29 -080011
12Anonymous Git is available via:
13
14 https://github.com/the-tcpdump-group/libpcap.git
15
The Android Open Source Project478ab6c2009-03-03 19:30:05 -080016This directory contains source code for libpcap, a system-independent
17interface for user-level packet capture. libpcap provides a portable
18framework for low-level network monitoring. Applications include
19network statistics collection, security monitoring, network debugging,
20etc. Since almost every system vendor provides a different interface
21for packet capture, and since we've developed several tools that
22require this functionality, we've created this system-independent API
23to ease in porting and to alleviate the need for several
24system-dependent packet capture modules in each application.
25
Elliott Hughes773b27c2021-08-20 17:37:36 -070026```text
27formerly from Lawrence Berkeley National Laboratory
28 Network Research Group <libpcap@ee.lbl.gov>
29 ftp://ftp.ee.lbl.gov/old/libpcap-0.4a7.tar.Z
30```
31
32### Support for particular platforms and BPF
33For some platforms there are `README.{system}` files that discuss issues
The Android Open Source Project478ab6c2009-03-03 19:30:05 -080034with the OS's interface for packet capture on those platforms, such as
35how to enable support for that interface in the OS, if it's not built in
36by default.
37
38The libpcap interface supports a filtering mechanism based on the
39architecture in the BSD packet filter. BPF is described in the 1993
40Winter Usenix paper ``The BSD Packet Filter: A New Architecture for
Elliott Hughes773b27c2021-08-20 17:37:36 -070041User-level Packet Capture''
42([compressed PostScript](https://www.tcpdump.org/papers/bpf-usenix93.ps.Z),
43[gzipped PostScript](https://www.tcpdump.org/papers/bpf-usenix93.ps.gz),
44[PDF](https://www.tcpdump.org/papers/bpf-usenix93.pdf)).
The Android Open Source Project478ab6c2009-03-03 19:30:05 -080045
46Although most packet capture interfaces support in-kernel filtering,
47libpcap utilizes in-kernel filtering only for the BPF interface.
48On systems that don't have BPF, all packets are read into user-space
49and the BPF filters are evaluated in the libpcap library, incurring
50added overhead (especially, for selective filters). Ideally, libpcap
51would translate BPF filters into a filter program that is compatible
52with the underlying kernel subsystem, but this is not yet implemented.
53
JP Abgrall511eca32014-02-12 13:46:45 -080054BPF is standard in 4.4BSD, BSD/OS, NetBSD, FreeBSD, OpenBSD, DragonFly
Haibo Huang165065a2018-07-23 17:26:52 -070055BSD, and macOS; an older, modified and undocumented version is standard
56in AIX. {DEC OSF/1, Digital UNIX, Tru64 UNIX} uses the packetfilter
57interface but has been extended to accept BPF filters (which libpcap
58utilizes). Also, you can add BPF filter support to Ultrix using the
Elliott Hughes773b27c2021-08-20 17:37:36 -070059kernel source and/or object patches available
60[here](https://www.tcpdump.org/other/bpfext42.tar.Z).
The Android Open Source Project478ab6c2009-03-03 19:30:05 -080061
Haibo Huang165065a2018-07-23 17:26:52 -070062Linux has a number of BPF based systems, and libpcap does not support
63any of the eBPF mechanisms as yet, although it supports many of the
64memory mapped receive mechanisms.
Elliott Hughes773b27c2021-08-20 17:37:36 -070065See the [Linux-specific README](doc/README.linux) for more information.
The Android Open Source Project478ab6c2009-03-03 19:30:05 -080066
Elliott Hughes773b27c2021-08-20 17:37:36 -070067### Note to Linux distributions and *BSD systems that include libpcap:
The Android Open Source Project478ab6c2009-03-03 19:30:05 -080068
Elliott Hughesd8845d72015-10-19 18:07:04 -070069There's now a rule to make a shared library, which should work on Linux
JP Abgrall511eca32014-02-12 13:46:45 -080070and *BSD, among other platforms.
71
Elliott Hughes773b27c2021-08-20 17:37:36 -070072It sets the soname of the library to `libpcap.so.1`; this is what it
73should be, **NOT** `libpcap.so.1.x` or `libpcap.so.1.x.y` or something such as
JP Abgrall511eca32014-02-12 13:46:45 -080074that.
75
Elliott Hughesd8845d72015-10-19 18:07:04 -070076We've been maintaining binary compatibility between libpcap releases for
77quite a while; there's no reason to tie a binary linked with libpcap to
JP Abgrall511eca32014-02-12 13:46:45 -080078a particular release of libpcap.