Code Monkey home page Code Monkey logo

pfq-pcap's Introduction

PFQ + libpcap

Introduction

PFQ is a network monitoring framework designed for the Linux operating system that allows efficient packet capturing, in-kernel functional processing and packet steering across sockets.

This version of pcap library is intended to support the PFQ framework, thus allowing legacy applications to exploit the capture acceleration of PFQ, and at the same time to take advantage of PFQ/lang computations to filter and dispatch packets across pcap sockets.

The pcap library interface is unchanged. Additional data (e.g. pfq group) is passed to the library as environment variables, while sniffing from multiple devices is possible by specifying their name in colon-separated fashion.

The greatest benefits are achieved with the cooperation of pfqd, a user-space daemon used to manage groups and in-kernel computations.

Features

  • 10-Gbit Line-rate (14,8Mpps) with tcpdump.
  • Parallel sessions of legacy applications through PFQ/lang computations.
  • Per-group in-kernel BPF (JIT compiled filters included).
  • Fully compliant with PFQ/lang and pfqd.

Details

This implementation of pcap library is extended to support PFQ sockets. By default the library makes use of AF_PACKET sockets. Only only when a special device name is provided the PFQ acceleration takes place.

The syntax of the device name is the following:

pfq[/config_file]:[device[:device[:device..]]]

Additional PFQ parameters are passed to the library in different ways, by means of environment variables or a configuration file.

Environment variables

The following variables specify additional PFQ parameters not allowed in pcap APIs:

Variable Meaning
PFQ_GROUP Specify the PFQ group for the process.
PFQ_CAPLEN Override the snaplen value.
PFQ_RX_SLOTS Define the RX queue length of the socket.
PFQ_TX_SLOTS Define the TX queue length of the socket.
PFQ_TX_QUEUE Set the TX HW queue passed to the driver.
PFQ_TX_NODE Set the core for the TX kthread (optional)
PFQ_TX_BATCH Set the transmission batch length.
PFQ_COMPUTATION Set the PFQ/lang computation for the group.

Configuration Files

In addition to the environmnet variables it is also possible to specify a configuration file on per-socket basis. This solve the problem of passing different values to multiple pcap devices in multi-threaded applications.

The path of the configuration file is passed to the library with the following syntax:

pfq/config_file:[device[:device[:device..]]]

The configuration is based on the simple key-value grammar.

# PFQ configuration file

group  = 11
caplen = 64

rx_slots = 131072

tx_node  = 1

computation = ip >-> steer_flow

Examples

Single tcpdump session:

PFQ_GROUP=42 tcpdump -n -i pfq:eth0:eth1

tcpdump using pfq-pcap.conf configuration file:

tcpdump -n -i pfq/pfq-pcap.conf:eth0:eth1

Load balancing TCP/UDP flows:

# master process set computation and binding to devices...

PFQ_GROUP=42 PFQ_COMPUTATION=steer_flow tcpdump -n -i pfq:eth0:eth1

# additional instances specify only the PFQ_GROUP...

PFQ_GORUP=42 tcpdump -n -i pfq
PFQ_GORUP=42 tcpdump -n -i pfq
PFQ_GORUP=42 tcpdump -n -i pfq
...

Authors

Nicola Bonelli [email protected]
Giacomo Volpi [email protected]

HomePage

PFQ home-page is www.pfq.io.

pfq-pcap's People

Contributors

awgn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.