Berkeley Packet Filter

The Berkeley Packet Filter or BPF provides, on some Unix-like systems, a raw interface to data link layers, permitting raw link-layer packets to be sent and received. In addition, if the driver for the network interface supports promiscuous mode, it allows the interface to be put into that mode, so that all packets on the network, even those destined for other hosts, can be received.

In addition, it supports "filtering" packets, so that only "interesting" packets can be supplied to the software using BPF; this can avoid copying "uninteresting" packets from the operating system kernel to software running in user mode, reducing the CPU requirement to capture packets and the buffer space required to avoid dropping packets. BPF's filtering capabilities are implemented as an interpreter for a machine language for the BPF virtual machine; programs in that language can fetch data from the packet, perform arithmetic operations on data from the packet, and compare the results against constants or against data in the packet or test bits in the results, accepting or rejecting the packet based on the results of those tests. On some platforms, including FreeBSD and WinPcap, just-in-time compilation is used to convert virtual machine instructions into native code in order to further avoid overhead.

Kernel-mode interpreters for that same virtual machine language are used in raw data link layer mechanisms in other operating systems, such as Tru64 Unix, and for socket filters in Linux and in the WinPcap packet capture mechanism.

A user-mode interpreter for it is provided with the libpcap/WinPcap implementation of the pcap application programming interface (API), so that, when capturing packets on systems without kernel-mode support for that filtering mechanism, packets can be filtered in user mode; code using the pcap API will work on both types of systems, although, on systems where the filtering is done in user mode, all packets, including those that will be filtered out, are copied from the kernel to user space. That interpreter can also be used when reading a file containing packets captured using pcap.

BPF is sometimes used to refer just to the filtering mechanism, rather than to the entire interface.

BSD kernels implement routines such as bpf_mtap and bpf_tap, with some wrapping them in macros such as BPF_MTAP and BPF_TAP, which are called by network interface drivers (and pseudo-drivers) to deliver incoming and outgoing packets to the BPF mechanism.

In August 2003, SCO Group publicly claimed to own Unix code which they alleged the Linux kernel infringed. Programmers quickly discovered the code in question was the Berkeley Packet Filter. While clear that SCO did not own the BPF code, they did not explain or acknowledge the mistake, although legal action is ongoing that may eventually force an answer.

In 2007, Robert Watson and Christian Peron added zero-copy buffer extensions to the BPF implementation in the FreeBSD operating system, allowing kernel packet capture in the device driver interrupt handler to write directly to user process memory in order to avoid the requirement for two copies for all packet data received via the BPF device. While one copy remains in the receipt path for user processes, this preserves the independence of different BPF device consumers, as well as allowing the packing of headers into the BPF buffer rather than copying complete packet data.

Other articles related to "packet, packets":

LRP Ration - Contents
... Each meal came in a tinfoil packet covered with olive-drab cloth, with a brown-foil accessory packet ... The accessory packet contained instant coffee (2 packets), cream substitute (1 4-gram packet), sugar (1 6-gram packet), salt (1 packet), Candy-Coated Gum (2 pieces), toilet paper, a book of cardboard ...
Secure Multicast
... IP Multicast is an internet communication method where a single data packet can be transmitted from a sender and replicated to a set of receivers ... media such as Ethernet or a satellite link automatically allows the data packet to be received by all the receivers directly attached to the media ... on media that is point-to-point or point-to-multipoint requires the packet to be replicated for each link ...
Spartan Packet Radio Experiment
... The Spartan Packet Radio Experiment (SPRE) was an Amateur Radio communications experiment that flew on the Space Shuttle Endeavor's STS-72 mission as part of NASA's Spartan/OAST-Flyer spacecraft in ... The experiment was intended to test the tracking of satellites via amateur packet radio (Automatic Packet Reporting System), and was designed and built by ... The operating mode was FM, AFSK 1200 baud packet radio, transmitted at 145.550 MHz ...
Packet - See Also
... All pages beginning with "Packet" All pages with titles containing "Packet" Package (disambiguation) Pack (disambiguation) Kit (disambiguation) ...

Famous quotes containing the words berkeley and/or packet:

    It is a mistake, to think the same thing affects both sight and touch. If the same angle or square, which is the object of touch, be also the object of vision, what should hinder the blind man, at first sight, from knowing it?
    —George Berkeley (1685–1753)

    The captain was a duck
    With a packet on his back,
    And when the ship began to move
    The captain said, Quack! Quack!
    Mother Goose (fl. 17th–18th century. I saw a ship a-sailing (l. 13–16)