Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 1 | # LIBPCAP 1.x.y by [The Tcpdump Group](https://www.tcpdump.org) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 2 | |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 3 | **To report a security issue please send an e-mail to security@tcpdump.org.** |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 4 | |
| 5 | To report bugs and other problems, contribute patches, request a |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 6 | feature, provide generic feedback etc please see the |
| 7 | [guidelines for contributing](CONTRIBUTING.md). |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 8 | |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 9 | The [documentation directory](doc/) has README files about specific |
| 10 | operating systems and options. |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 11 | |
| 12 | Anonymous Git is available via: |
| 13 | |
| 14 | https://github.com/the-tcpdump-group/libpcap.git |
| 15 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 16 | This directory contains source code for libpcap, a system-independent |
| 17 | interface for user-level packet capture. libpcap provides a portable |
| 18 | framework for low-level network monitoring. Applications include |
| 19 | network statistics collection, security monitoring, network debugging, |
| 20 | etc. Since almost every system vendor provides a different interface |
| 21 | for packet capture, and since we've developed several tools that |
| 22 | require this functionality, we've created this system-independent API |
| 23 | to ease in porting and to alleviate the need for several |
| 24 | system-dependent packet capture modules in each application. |
| 25 | |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 26 | ```text |
| 27 | formerly 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 |
| 33 | For some platforms there are `README.{system}` files that discuss issues |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 34 | with the OS's interface for packet capture on those platforms, such as |
| 35 | how to enable support for that interface in the OS, if it's not built in |
| 36 | by default. |
| 37 | |
| 38 | The libpcap interface supports a filtering mechanism based on the |
| 39 | architecture in the BSD packet filter. BPF is described in the 1993 |
| 40 | Winter Usenix paper ``The BSD Packet Filter: A New Architecture for |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 41 | User-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 Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 45 | |
| 46 | Although most packet capture interfaces support in-kernel filtering, |
| 47 | libpcap utilizes in-kernel filtering only for the BPF interface. |
| 48 | On systems that don't have BPF, all packets are read into user-space |
| 49 | and the BPF filters are evaluated in the libpcap library, incurring |
| 50 | added overhead (especially, for selective filters). Ideally, libpcap |
| 51 | would translate BPF filters into a filter program that is compatible |
| 52 | with the underlying kernel subsystem, but this is not yet implemented. |
| 53 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 54 | BPF is standard in 4.4BSD, BSD/OS, NetBSD, FreeBSD, OpenBSD, DragonFly |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 55 | BSD, and macOS; an older, modified and undocumented version is standard |
| 56 | in AIX. {DEC OSF/1, Digital UNIX, Tru64 UNIX} uses the packetfilter |
| 57 | interface but has been extended to accept BPF filters (which libpcap |
| 58 | utilizes). Also, you can add BPF filter support to Ultrix using the |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 59 | kernel source and/or object patches available |
| 60 | [here](https://www.tcpdump.org/other/bpfext42.tar.Z). |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 61 | |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 62 | Linux has a number of BPF based systems, and libpcap does not support |
| 63 | any of the eBPF mechanisms as yet, although it supports many of the |
| 64 | memory mapped receive mechanisms. |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 65 | See the [Linux-specific README](doc/README.linux) for more information. |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 66 | |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 67 | ### Note to Linux distributions and *BSD systems that include libpcap: |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 68 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 69 | There's now a rule to make a shared library, which should work on Linux |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 70 | and *BSD, among other platforms. |
| 71 | |
Elliott Hughes | 773b27c | 2021-08-20 17:37:36 -0700 | [diff] [blame] | 72 | It sets the soname of the library to `libpcap.so.1`; this is what it |
| 73 | should be, **NOT** `libpcap.so.1.x` or `libpcap.so.1.x.y` or something such as |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 74 | that. |
| 75 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 76 | We've been maintaining binary compatibility between libpcap releases for |
| 77 | quite a while; there's no reason to tie a binary linked with libpcap to |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 78 | a particular release of libpcap. |