SlideShare a Scribd company logo
FOSDEM’19 • Brussels, 2019-02-02
Unifying network filtering rules for the Linux kernel with eBPF
Quentin Monnet
<quentin.monnet@netronome.com>
@qeole
Outline
Several network filtering mechanisms in the Linux kernel
What are they, and what do they do?
How are they used?
Latest addition: eBPF
What does it bring to filter networking?
Increasing number of convergence leads between the different models
What are the objectives?
How can they be unified?
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 2/22
Some network filtering mechanisms in the Linux kernel
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 3/22
Netfilter (iptables/nf_tables)
Framework for packet filtering (firewall), NAT
Often the default choice for dropping flows
Several front-end components (ebtables, arptables, iptables, ip6tables,
nf_tables, conntrack)
Back-end: Netfilter
nf_tables successor to iptables: more flexible, more efficient
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 4/22
Traffic Control filters (tc, iproute2)
TC framework for Traffic Control in the kernel: traffic shaping, scheduling,
policing, dropping
“Queueing disciplines” (qdisc), possibly applied to “classes”
Filters are used to dispatch packets into the different classes
(Traffic control mostly applies to egress traffic, but filters also usable
for ingress)
Framework actually using a variety of filters:
• basic (ematch, “extended match”)
• flow
• flower
• u32
• [bpf]
• Specific filters: fw, route, rsvp, tcindex
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 5/22
Hardware filters (ethtool)
“Receive network flow classification”: Hardware filters
Main objective: flow steering, but able to drop flows
Needs hardware support, not all NICs have it
Rules set with ethtool -U (ioctl)
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 6/22
pcap-filters, cBPF (e.g. for tcpdump)
Facility from the libpcap library
Takes an expression and turns it into a filter
Output is legacy BPF (cBPF), attached to sockets in the kernel
(or run in user space if not on Linux)
Used by tcpdump (see tcpdump -i eth0 -d <expr>)
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 7/22
Filtering hooks
Kernel
Userspace
Hardware (NIC)
Driver
Kernel stack
TC ingress TC egress
Hardware filters
(set up with ethtool)
BPF
on socket
Netfilter egress
(OUTPUT, POSTROUTING)
Netfilter ingress
(PREROUTING, INPUT)
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 8/22
Many rule syntaxes
Example rule: Drop incoming IP(v4) HTTP packets
# iptables -A INPUT -i eth0 
-p tcp --dport 80 -j drop
# nft add rule ip filter input iif eth0 
tcp dport 80 drop
# tcpdump -i eth0 
ip and tcp dst port 80
# tc filter add dev eth0 ingress flower 
ip_proto tcp dst_port 80 action drop
# ethtool -U eth0 
flow-type tcp4 dst-port 80 action -1
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 9/22
Many other ways to filter packets
The list is not exhaustive
Other frameworks are available (many of them out of kernel space)
Software switches: Open vSwitch, etc.
User space processing: DPDK (rte-flows), firewall apps, etc.
P4 as another way to implement switches/filters, compile to target
…
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 10/22
Enter eBPF
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 11/22
Introduction to eBPF
Generic, efficient, secure in-kernel (Linux) virtual machine
Event-based programs injected, verified and attached in the kernel
Lightweight Tunnel
Encapsulation
TC
(traffic control)
Cgroups
Perf Event
Tracepoint
XDP
(network driver)
Sockets
Kprobe/Uprobe
Others to come?
Networking
Tracing/Monitoring
Flow Dissector
Infrared
Remote Control
eBPF
Specific features: Maps, tail calls, helper functions
In the rest of the presentation: “BPF” means “eBPF”
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 12/22
BPF hooks for network packet processing
Kernel
Userspace
Hardware (NIC)
Driver
Kernel stack
TC ingress TC egress
Hardware filters
(set up with ethtool)
BPF
on socket
Netfilter egress
(OUTPUT, POSTROUTING)
Netfilter ingress
(PREROUTING, INPUT)
Agilio SmartNIC
BPF
(TC/XDP offload)
BPF XDP
(“generic”)
BPF XDP
(driver support)
BPF
as TC filter
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 13/22
What BPF brings to network filtering
BPF is POWER!
Programmability (change network processing at runtime)
In-kernel verifier: safety, security of the programs
JIT (Just-in-time) compiler available for main architectures: speed!
Low-level (driver hooks): speed!!
Hardware offload: speed!!!
Also:
Headaches, long nights spent rewriting the filters
Additional pain to pass the verifier
But keep in mind: BPF is self-contained, well defined, flexible
Maybe a good intermediate representation to represent filters?
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 14/22
Convergence of the models
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 15/22
Why unifying?
User side:
Transparently reuse existing set of rules
Benefit from the best of each world: flexibility, ease of use,
performance
Developer side:
Easier to work on a common intermediate representation rather than
on a variety of distinct back-ends
Better uncoupling of the front- and back-ends
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 16/22
flow_rule infrastructure
Work in progress from Pablo Neira Ayuso—No BPF in this one
Intermediate representation for ACL hardware offloads
Based on Linux flow dissector infrastructure and TC actions
Can be used by different front-ends such as HW filters, TC, Netfilter
Kernel
Userspace
Hardware (NIC)
Driver
Kernel front end
Hardware IR
flow_rule IR
TC
(via Netlink)
Hardware filters
(via ioctl)
Netfilter
(via Netlink)
Parses flow_rule IR
to populate HW IR
Translates native
interface representation
to flow_rule IR
Offloads filter
as HW IR
Motivation:
Unified IR passed to the driver: avoid having one parser for each ACL front-end
Stop exposing TC front-end details to drivers (easier to add features to TC)
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 17/22
bpfilter: BPF-based firewall
bpfilter: new back-end for iptables in Linux, based on BPF
The iptables binary is left untouched
Rules are translated into a BPF program
Uses a special kernel module launching an ELF executable in a special thread in
user space, for rule translation
Also: proposal for nf_tables to BPF translation on top of bpfilter
Kernel
Userspace
bpfilter UMH
special thread
bpfilter.ko
module
Netfilter
subsystem
bpfilter
BPF hook
iptables
inject rules
translates
rules to eBPF
Motivation:
Reuse rules from iptables
Improve performance (JIT, offloads)
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 18/22
libkefir: a library to convert ACLs to BPF programs
libkefir: KErnel FIltering Rules: Work in progress @ Netronome
Turn simple ACL rules into hackable BPF programs
Motivation similar to bpfilter: reuse rules, with improved performance
But do not try to handle all cases
And give BPF-compatible C source code to users, so they can hack it
Comes as a library, for inclusion in other projects
Kernel
Userspace
TC flower
rules
ethtool rules
pcap-lib
expressions
iptables rules
libkefir
BPF bytecode
BPF program
attached
C source code
Sorry, not published yet!
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 19/22
Wrapping up
Various frameworks for packet filtering in Linux
BPF is one of them, brings new perspectives in terms of programmability,
performance, speed, speed and speed
Convergence between different models is beginning to emerge:
Easier handling of rules for driver developers (flow_rule IR proposal)
Reuse of existing rules for users (bpfilter, libkefir)
Better performance for those existing set of rules
Also, consider:
P4 as another approach for convergence—BPF is one target
BPF used in other places: Open vSwitch datapath, DPDK
eBPF as a heterogeneous processing ABI (LPC 2018)
Usage of a DSL for producing BPF programs, but targeted at tracing the
Linux kernel: bpftrace
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 20/22
Thank you!
Questions
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 21/22
References
Additional resources:
Dive into BPF: a list of reading material
https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/
Why is the kernel community replacing iptables with BPF?
https://cilium.io/blog/2018/04/17/why-is-the-kernel-community-replacing-iptables/
[PATCH net-next,v6 00/12] add flow_rule infrastructure
https://lwn.net/ml/netdev/20181214181205.28812-1-pablo%40netfilter.org/
BPF comes to firewalls
https://lwn.net/Articles/747551/
Bringing the Power of eBPF to Open vSwitch (William Tu et al., LPC 2018)
http://vger.kernel.org/lpc_net2018_talks/ovs-ebpf-lpc18-presentation.pdf
Using eBPF as a heterogeneous ABI (Jakub Kicinski, LPC 2018)
http://vger.kernel.org/lpc-bpf.html#session-8
DPDK documentation, Berkeley Packet Filter Library
http://doc.dpdk.org/guides/prog_guide/bpf_lib.html
Nothing yet on libkefir… Stay tuned!
Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 22/22

More Related Content

What's hot

eBPF Basics
eBPF BasicseBPF Basics
eBPF Basics
Michael Kehoe
 
Kernel Recipes 2017 - EBPF and XDP - Eric Leblond
Kernel Recipes 2017 - EBPF and XDP - Eric LeblondKernel Recipes 2017 - EBPF and XDP - Eric Leblond
Kernel Recipes 2017 - EBPF and XDP - Eric Leblond
Anne Nicolas
 
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCBuilding Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
Kernel TLV
 
VLANs in the Linux Kernel
VLANs in the Linux KernelVLANs in the Linux Kernel
VLANs in the Linux Kernel
Kernel TLV
 
eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux Kernel
Thomas Graf
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
Brendan Gregg
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
Kernel TLV
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
Adrien Mahieux
 
Introduction to eBPF and XDP
Introduction to eBPF and XDPIntroduction to eBPF and XDP
Introduction to eBPF and XDP
lcplcp1
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
Viller Hsiao
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
Michelle Holley
 
OVN Controller Incremental Processing
OVN Controller Incremental ProcessingOVN Controller Incremental Processing
OVN Controller Incremental Processing
Han Zhou
 
EBPF and Linux Networking
EBPF and Linux NetworkingEBPF and Linux Networking
EBPF and Linux Networking
PLUMgrid
 
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to UserspaceeBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
SUSE Labs Taipei
 
Enable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zunEnable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zun
heut2008
 
Accelerating Envoy and Istio with Cilium and the Linux Kernel
Accelerating Envoy and Istio with Cilium and the Linux KernelAccelerating Envoy and Istio with Cilium and the Linux Kernel
Accelerating Envoy and Istio with Cilium and the Linux Kernel
Thomas Graf
 
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpointsDebug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
Vipin Varghese
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
Kernel TLV
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 

What's hot (20)

eBPF Basics
eBPF BasicseBPF Basics
eBPF Basics
 
Kernel Recipes 2017 - EBPF and XDP - Eric Leblond
Kernel Recipes 2017 - EBPF and XDP - Eric LeblondKernel Recipes 2017 - EBPF and XDP - Eric Leblond
Kernel Recipes 2017 - EBPF and XDP - Eric Leblond
 
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCBuilding Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
 
VLANs in the Linux Kernel
VLANs in the Linux KernelVLANs in the Linux Kernel
VLANs in the Linux Kernel
 
eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux Kernel
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
Introduction to eBPF and XDP
Introduction to eBPF and XDPIntroduction to eBPF and XDP
Introduction to eBPF and XDP
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 
OVN Controller Incremental Processing
OVN Controller Incremental ProcessingOVN Controller Incremental Processing
OVN Controller Incremental Processing
 
EBPF and Linux Networking
EBPF and Linux NetworkingEBPF and Linux Networking
EBPF and Linux Networking
 
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to UserspaceeBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
 
Enable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zunEnable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zun
 
Accelerating Envoy and Istio with Cilium and the Linux Kernel
Accelerating Envoy and Istio with Cilium and the Linux KernelAccelerating Envoy and Istio with Cilium and the Linux Kernel
Accelerating Envoy and Istio with Cilium and the Linux Kernel
 
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpointsDebug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
 

Similar to Unifying Network Filtering Rules for the Linux Kernel with eBPF

Replacing iptables with eBPF in Kubernetes with Cilium
Replacing iptables with eBPF in Kubernetes with CiliumReplacing iptables with eBPF in Kubernetes with Cilium
Replacing iptables with eBPF in Kubernetes with Cilium
Michal Rostecki
 
Dataplane programming with eBPF: architecture and tools
Dataplane programming with eBPF: architecture and toolsDataplane programming with eBPF: architecture and tools
Dataplane programming with eBPF: architecture and tools
Stefano Salsano
 
Security Monitoring with eBPF
Security Monitoring with eBPFSecurity Monitoring with eBPF
Security Monitoring with eBPF
Alex Maestretti
 
ebpf and IO Visor: The What, how, and what next!
ebpf and IO Visor: The What, how, and what next!ebpf and IO Visor: The What, how, and what next!
ebpf and IO Visor: The What, how, and what next!
Affan Syed
 
iptables 101- bottom-up
iptables 101- bottom-upiptables 101- bottom-up
iptables 101- bottom-up
HungWei Chiu
 
Berkeley Packet Filters
Berkeley Packet FiltersBerkeley Packet Filters
Berkeley Packet Filters
Kernel TLV
 
SRE NL MeetUp - eBPF.pdf
SRE NL MeetUp - eBPF.pdfSRE NL MeetUp - eBPF.pdf
SRE NL MeetUp - eBPF.pdf
SiteReliabilityEngin
 
Kernel bug hunting
Kernel bug huntingKernel bug hunting
Kernel bug hunting
Andrea Righi
 
Making our networking stack truly extensible
Making our networking stack truly extensible Making our networking stack truly extensible
Making our networking stack truly extensible
Olivier Bonaventure
 
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Hajime Tazaki
 
Network stack personality in Android phone - netdev 2.2
Network stack personality in Android phone - netdev 2.2Network stack personality in Android phone - netdev 2.2
Network stack personality in Android phone - netdev 2.2
Hajime Tazaki
 
Kubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep DiveKubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep Dive
Michal Rostecki
 
Install FD.IO VPP On Intel(r) Architecture & Test with Trex*
Install FD.IO VPP On Intel(r) Architecture & Test with Trex*Install FD.IO VPP On Intel(r) Architecture & Test with Trex*
Install FD.IO VPP On Intel(r) Architecture & Test with Trex*
Michelle Holley
 
eBPF - Observability In Deep
eBPF - Observability In DeepeBPF - Observability In Deep
eBPF - Observability In Deep
Mydbops
 
BPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveBPF Hardware Offload Deep Dive
BPF Hardware Offload Deep Dive
Netronome
 
Summit 16: How to Compose a New OPNFV Solution Stack?
Summit 16: How to Compose a New OPNFV Solution Stack?Summit 16: How to Compose a New OPNFV Solution Stack?
Summit 16: How to Compose a New OPNFV Solution Stack?
OPNFV
 
An Introduce of OPNFV (Open Platform for NFV)
An Introduce of OPNFV (Open Platform for NFV)An Introduce of OPNFV (Open Platform for NFV)
An Introduce of OPNFV (Open Platform for NFV)
Mario Cho
 
Stacks and Layers: Integrating P4, C, OVS and OpenStack
Stacks and Layers: Integrating P4, C, OVS and OpenStackStacks and Layers: Integrating P4, C, OVS and OpenStack
Stacks and Layers: Integrating P4, C, OVS and OpenStack
Open-NFP
 
Netlink-Optimization.pptx
Netlink-Optimization.pptxNetlink-Optimization.pptx
Netlink-Optimization.pptx
KalimuthuVelappan
 

Similar to Unifying Network Filtering Rules for the Linux Kernel with eBPF (20)

Replacing iptables with eBPF in Kubernetes with Cilium
Replacing iptables with eBPF in Kubernetes with CiliumReplacing iptables with eBPF in Kubernetes with Cilium
Replacing iptables with eBPF in Kubernetes with Cilium
 
Dataplane programming with eBPF: architecture and tools
Dataplane programming with eBPF: architecture and toolsDataplane programming with eBPF: architecture and tools
Dataplane programming with eBPF: architecture and tools
 
Security Monitoring with eBPF
Security Monitoring with eBPFSecurity Monitoring with eBPF
Security Monitoring with eBPF
 
ebpf and IO Visor: The What, how, and what next!
ebpf and IO Visor: The What, how, and what next!ebpf and IO Visor: The What, how, and what next!
ebpf and IO Visor: The What, how, and what next!
 
iptables 101- bottom-up
iptables 101- bottom-upiptables 101- bottom-up
iptables 101- bottom-up
 
Berkeley Packet Filters
Berkeley Packet FiltersBerkeley Packet Filters
Berkeley Packet Filters
 
SRE NL MeetUp - eBPF.pdf
SRE NL MeetUp - eBPF.pdfSRE NL MeetUp - eBPF.pdf
SRE NL MeetUp - eBPF.pdf
 
Kernel bug hunting
Kernel bug huntingKernel bug hunting
Kernel bug hunting
 
Making our networking stack truly extensible
Making our networking stack truly extensible Making our networking stack truly extensible
Making our networking stack truly extensible
 
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
Linux rumpkernel - ABC2018 (AsiaBSDCon 2018)
 
Network stack personality in Android phone - netdev 2.2
Network stack personality in Android phone - netdev 2.2Network stack personality in Android phone - netdev 2.2
Network stack personality in Android phone - netdev 2.2
 
Kubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep DiveKubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep Dive
 
Install FD.IO VPP On Intel(r) Architecture & Test with Trex*
Install FD.IO VPP On Intel(r) Architecture & Test with Trex*Install FD.IO VPP On Intel(r) Architecture & Test with Trex*
Install FD.IO VPP On Intel(r) Architecture & Test with Trex*
 
eBPF - Observability In Deep
eBPF - Observability In DeepeBPF - Observability In Deep
eBPF - Observability In Deep
 
SudheerV_resume_a
SudheerV_resume_aSudheerV_resume_a
SudheerV_resume_a
 
BPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveBPF Hardware Offload Deep Dive
BPF Hardware Offload Deep Dive
 
Summit 16: How to Compose a New OPNFV Solution Stack?
Summit 16: How to Compose a New OPNFV Solution Stack?Summit 16: How to Compose a New OPNFV Solution Stack?
Summit 16: How to Compose a New OPNFV Solution Stack?
 
An Introduce of OPNFV (Open Platform for NFV)
An Introduce of OPNFV (Open Platform for NFV)An Introduce of OPNFV (Open Platform for NFV)
An Introduce of OPNFV (Open Platform for NFV)
 
Stacks and Layers: Integrating P4, C, OVS and OpenStack
Stacks and Layers: Integrating P4, C, OVS and OpenStackStacks and Layers: Integrating P4, C, OVS and OpenStack
Stacks and Layers: Integrating P4, C, OVS and OpenStack
 
Netlink-Optimization.pptx
Netlink-Optimization.pptxNetlink-Optimization.pptx
Netlink-Optimization.pptx
 

More from Netronome

Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...
Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...
Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...
Netronome
 
LFSMM AF XDP Queue I-DS
LFSMM AF XDP Queue I-DSLFSMM AF XDP Queue I-DS
LFSMM AF XDP Queue I-DS
Netronome
 
LFSMM Verifier Optimizations and 1 M Instructions
LFSMM Verifier Optimizations and 1 M InstructionsLFSMM Verifier Optimizations and 1 M Instructions
LFSMM Verifier Optimizations and 1 M Instructions
Netronome
 
Using Network Acceleration for an Optimized Edge Cloud Server Architecture
Using Network Acceleration for an Optimized Edge Cloud Server ArchitectureUsing Network Acceleration for an Optimized Edge Cloud Server Architecture
Using Network Acceleration for an Optimized Edge Cloud Server Architecture
Netronome
 
Offloading TC Rules on OVS Internal Ports
Offloading TC Rules on OVS Internal Ports Offloading TC Rules on OVS Internal Ports
Offloading TC Rules on OVS Internal Ports
Netronome
 
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware OffloadsQuality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
Netronome
 
ODSA Sub-Project Launch
 ODSA Sub-Project Launch ODSA Sub-Project Launch
ODSA Sub-Project Launch
Netronome
 
Flexible and Scalable Domain-Specific Architectures
Flexible and Scalable Domain-Specific ArchitecturesFlexible and Scalable Domain-Specific Architectures
Flexible and Scalable Domain-Specific Architectures
Netronome
 
Massively Parallel RISC-V Processing with Transactional Memory
Massively Parallel RISC-V Processing with Transactional MemoryMassively Parallel RISC-V Processing with Transactional Memory
Massively Parallel RISC-V Processing with Transactional Memory
Netronome
 
Offloading Linux LAG Devices Via Open vSwitch and TC
Offloading Linux LAG Devices Via Open vSwitch and TCOffloading Linux LAG Devices Via Open vSwitch and TC
Offloading Linux LAG Devices Via Open vSwitch and TC
Netronome
 
eBPF Debugging Infrastructure - Current Techniques
eBPF Debugging Infrastructure - Current TechniqueseBPF Debugging Infrastructure - Current Techniques
eBPF Debugging Infrastructure - Current Techniques
Netronome
 
Efficient JIT to 32-bit Arches
Efficient JIT to 32-bit ArchesEfficient JIT to 32-bit Arches
Efficient JIT to 32-bit Arches
Netronome
 
eBPF & Switch Abstractions
eBPF & Switch AbstractionseBPF & Switch Abstractions
eBPF & Switch Abstractions
Netronome
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging Infrastructure
Netronome
 
Demystify eBPF JIT Compiler
Demystify eBPF JIT CompilerDemystify eBPF JIT Compiler
Demystify eBPF JIT Compiler
Netronome
 
P4 Introduction
P4 Introduction P4 Introduction
P4 Introduction
Netronome
 
Host Data Plane Acceleration: SmartNIC Deployment Models
Host Data Plane Acceleration: SmartNIC Deployment ModelsHost Data Plane Acceleration: SmartNIC Deployment Models
Host Data Plane Acceleration: SmartNIC Deployment Models
Netronome
 
The Power of SmartNICs
The Power of SmartNICsThe Power of SmartNICs
The Power of SmartNICs
Netronome
 
DPDK Support for New HW Offloads
DPDK Support for New HW OffloadsDPDK Support for New HW Offloads
DPDK Support for New HW Offloads
Netronome
 
Comprehensive XDP Off‌load-handling the Edge Cases
Comprehensive XDP Off‌load-handling the Edge CasesComprehensive XDP Off‌load-handling the Edge Cases
Comprehensive XDP Off‌load-handling the Edge Cases
Netronome
 

More from Netronome (20)

Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...
Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...
Disaggregation a Primer: Optimizing design for Edge Cloud & Bare Metal applic...
 
LFSMM AF XDP Queue I-DS
LFSMM AF XDP Queue I-DSLFSMM AF XDP Queue I-DS
LFSMM AF XDP Queue I-DS
 
LFSMM Verifier Optimizations and 1 M Instructions
LFSMM Verifier Optimizations and 1 M InstructionsLFSMM Verifier Optimizations and 1 M Instructions
LFSMM Verifier Optimizations and 1 M Instructions
 
Using Network Acceleration for an Optimized Edge Cloud Server Architecture
Using Network Acceleration for an Optimized Edge Cloud Server ArchitectureUsing Network Acceleration for an Optimized Edge Cloud Server Architecture
Using Network Acceleration for an Optimized Edge Cloud Server Architecture
 
Offloading TC Rules on OVS Internal Ports
Offloading TC Rules on OVS Internal Ports Offloading TC Rules on OVS Internal Ports
Offloading TC Rules on OVS Internal Ports
 
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware OffloadsQuality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
 
ODSA Sub-Project Launch
 ODSA Sub-Project Launch ODSA Sub-Project Launch
ODSA Sub-Project Launch
 
Flexible and Scalable Domain-Specific Architectures
Flexible and Scalable Domain-Specific ArchitecturesFlexible and Scalable Domain-Specific Architectures
Flexible and Scalable Domain-Specific Architectures
 
Massively Parallel RISC-V Processing with Transactional Memory
Massively Parallel RISC-V Processing with Transactional MemoryMassively Parallel RISC-V Processing with Transactional Memory
Massively Parallel RISC-V Processing with Transactional Memory
 
Offloading Linux LAG Devices Via Open vSwitch and TC
Offloading Linux LAG Devices Via Open vSwitch and TCOffloading Linux LAG Devices Via Open vSwitch and TC
Offloading Linux LAG Devices Via Open vSwitch and TC
 
eBPF Debugging Infrastructure - Current Techniques
eBPF Debugging Infrastructure - Current TechniqueseBPF Debugging Infrastructure - Current Techniques
eBPF Debugging Infrastructure - Current Techniques
 
Efficient JIT to 32-bit Arches
Efficient JIT to 32-bit ArchesEfficient JIT to 32-bit Arches
Efficient JIT to 32-bit Arches
 
eBPF & Switch Abstractions
eBPF & Switch AbstractionseBPF & Switch Abstractions
eBPF & Switch Abstractions
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging Infrastructure
 
Demystify eBPF JIT Compiler
Demystify eBPF JIT CompilerDemystify eBPF JIT Compiler
Demystify eBPF JIT Compiler
 
P4 Introduction
P4 Introduction P4 Introduction
P4 Introduction
 
Host Data Plane Acceleration: SmartNIC Deployment Models
Host Data Plane Acceleration: SmartNIC Deployment ModelsHost Data Plane Acceleration: SmartNIC Deployment Models
Host Data Plane Acceleration: SmartNIC Deployment Models
 
The Power of SmartNICs
The Power of SmartNICsThe Power of SmartNICs
The Power of SmartNICs
 
DPDK Support for New HW Offloads
DPDK Support for New HW OffloadsDPDK Support for New HW Offloads
DPDK Support for New HW Offloads
 
Comprehensive XDP Off‌load-handling the Edge Cases
Comprehensive XDP Off‌load-handling the Edge CasesComprehensive XDP Off‌load-handling the Edge Cases
Comprehensive XDP Off‌load-handling the Edge Cases
 

Recently uploaded

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 

Recently uploaded (20)

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 

Unifying Network Filtering Rules for the Linux Kernel with eBPF

  • 1. FOSDEM’19 • Brussels, 2019-02-02 Unifying network filtering rules for the Linux kernel with eBPF Quentin Monnet <quentin.monnet@netronome.com> @qeole
  • 2. Outline Several network filtering mechanisms in the Linux kernel What are they, and what do they do? How are they used? Latest addition: eBPF What does it bring to filter networking? Increasing number of convergence leads between the different models What are the objectives? How can they be unified? Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 2/22
  • 3. Some network filtering mechanisms in the Linux kernel Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 3/22
  • 4. Netfilter (iptables/nf_tables) Framework for packet filtering (firewall), NAT Often the default choice for dropping flows Several front-end components (ebtables, arptables, iptables, ip6tables, nf_tables, conntrack) Back-end: Netfilter nf_tables successor to iptables: more flexible, more efficient Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 4/22
  • 5. Traffic Control filters (tc, iproute2) TC framework for Traffic Control in the kernel: traffic shaping, scheduling, policing, dropping “Queueing disciplines” (qdisc), possibly applied to “classes” Filters are used to dispatch packets into the different classes (Traffic control mostly applies to egress traffic, but filters also usable for ingress) Framework actually using a variety of filters: • basic (ematch, “extended match”) • flow • flower • u32 • [bpf] • Specific filters: fw, route, rsvp, tcindex Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 5/22
  • 6. Hardware filters (ethtool) “Receive network flow classification”: Hardware filters Main objective: flow steering, but able to drop flows Needs hardware support, not all NICs have it Rules set with ethtool -U (ioctl) Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 6/22
  • 7. pcap-filters, cBPF (e.g. for tcpdump) Facility from the libpcap library Takes an expression and turns it into a filter Output is legacy BPF (cBPF), attached to sockets in the kernel (or run in user space if not on Linux) Used by tcpdump (see tcpdump -i eth0 -d <expr>) Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 7/22
  • 8. Filtering hooks Kernel Userspace Hardware (NIC) Driver Kernel stack TC ingress TC egress Hardware filters (set up with ethtool) BPF on socket Netfilter egress (OUTPUT, POSTROUTING) Netfilter ingress (PREROUTING, INPUT) Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 8/22
  • 9. Many rule syntaxes Example rule: Drop incoming IP(v4) HTTP packets # iptables -A INPUT -i eth0 -p tcp --dport 80 -j drop # nft add rule ip filter input iif eth0 tcp dport 80 drop # tcpdump -i eth0 ip and tcp dst port 80 # tc filter add dev eth0 ingress flower ip_proto tcp dst_port 80 action drop # ethtool -U eth0 flow-type tcp4 dst-port 80 action -1 Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 9/22
  • 10. Many other ways to filter packets The list is not exhaustive Other frameworks are available (many of them out of kernel space) Software switches: Open vSwitch, etc. User space processing: DPDK (rte-flows), firewall apps, etc. P4 as another way to implement switches/filters, compile to target … Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 10/22
  • 11. Enter eBPF Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 11/22
  • 12. Introduction to eBPF Generic, efficient, secure in-kernel (Linux) virtual machine Event-based programs injected, verified and attached in the kernel Lightweight Tunnel Encapsulation TC (traffic control) Cgroups Perf Event Tracepoint XDP (network driver) Sockets Kprobe/Uprobe Others to come? Networking Tracing/Monitoring Flow Dissector Infrared Remote Control eBPF Specific features: Maps, tail calls, helper functions In the rest of the presentation: “BPF” means “eBPF” Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 12/22
  • 13. BPF hooks for network packet processing Kernel Userspace Hardware (NIC) Driver Kernel stack TC ingress TC egress Hardware filters (set up with ethtool) BPF on socket Netfilter egress (OUTPUT, POSTROUTING) Netfilter ingress (PREROUTING, INPUT) Agilio SmartNIC BPF (TC/XDP offload) BPF XDP (“generic”) BPF XDP (driver support) BPF as TC filter Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 13/22
  • 14. What BPF brings to network filtering BPF is POWER! Programmability (change network processing at runtime) In-kernel verifier: safety, security of the programs JIT (Just-in-time) compiler available for main architectures: speed! Low-level (driver hooks): speed!! Hardware offload: speed!!! Also: Headaches, long nights spent rewriting the filters Additional pain to pass the verifier But keep in mind: BPF is self-contained, well defined, flexible Maybe a good intermediate representation to represent filters? Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 14/22
  • 15. Convergence of the models Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 15/22
  • 16. Why unifying? User side: Transparently reuse existing set of rules Benefit from the best of each world: flexibility, ease of use, performance Developer side: Easier to work on a common intermediate representation rather than on a variety of distinct back-ends Better uncoupling of the front- and back-ends Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 16/22
  • 17. flow_rule infrastructure Work in progress from Pablo Neira Ayuso—No BPF in this one Intermediate representation for ACL hardware offloads Based on Linux flow dissector infrastructure and TC actions Can be used by different front-ends such as HW filters, TC, Netfilter Kernel Userspace Hardware (NIC) Driver Kernel front end Hardware IR flow_rule IR TC (via Netlink) Hardware filters (via ioctl) Netfilter (via Netlink) Parses flow_rule IR to populate HW IR Translates native interface representation to flow_rule IR Offloads filter as HW IR Motivation: Unified IR passed to the driver: avoid having one parser for each ACL front-end Stop exposing TC front-end details to drivers (easier to add features to TC) Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 17/22
  • 18. bpfilter: BPF-based firewall bpfilter: new back-end for iptables in Linux, based on BPF The iptables binary is left untouched Rules are translated into a BPF program Uses a special kernel module launching an ELF executable in a special thread in user space, for rule translation Also: proposal for nf_tables to BPF translation on top of bpfilter Kernel Userspace bpfilter UMH special thread bpfilter.ko module Netfilter subsystem bpfilter BPF hook iptables inject rules translates rules to eBPF Motivation: Reuse rules from iptables Improve performance (JIT, offloads) Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 18/22
  • 19. libkefir: a library to convert ACLs to BPF programs libkefir: KErnel FIltering Rules: Work in progress @ Netronome Turn simple ACL rules into hackable BPF programs Motivation similar to bpfilter: reuse rules, with improved performance But do not try to handle all cases And give BPF-compatible C source code to users, so they can hack it Comes as a library, for inclusion in other projects Kernel Userspace TC flower rules ethtool rules pcap-lib expressions iptables rules libkefir BPF bytecode BPF program attached C source code Sorry, not published yet! Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 19/22
  • 20. Wrapping up Various frameworks for packet filtering in Linux BPF is one of them, brings new perspectives in terms of programmability, performance, speed, speed and speed Convergence between different models is beginning to emerge: Easier handling of rules for driver developers (flow_rule IR proposal) Reuse of existing rules for users (bpfilter, libkefir) Better performance for those existing set of rules Also, consider: P4 as another approach for convergence—BPF is one target BPF used in other places: Open vSwitch datapath, DPDK eBPF as a heterogeneous processing ABI (LPC 2018) Usage of a DSL for producing BPF programs, but targeted at tracing the Linux kernel: bpftrace Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 20/22
  • 21. Thank you! Questions Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 21/22
  • 22. References Additional resources: Dive into BPF: a list of reading material https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/ Why is the kernel community replacing iptables with BPF? https://cilium.io/blog/2018/04/17/why-is-the-kernel-community-replacing-iptables/ [PATCH net-next,v6 00/12] add flow_rule infrastructure https://lwn.net/ml/netdev/20181214181205.28812-1-pablo%40netfilter.org/ BPF comes to firewalls https://lwn.net/Articles/747551/ Bringing the Power of eBPF to Open vSwitch (William Tu et al., LPC 2018) http://vger.kernel.org/lpc_net2018_talks/ovs-ebpf-lpc18-presentation.pdf Using eBPF as a heterogeneous ABI (Jakub Kicinski, LPC 2018) http://vger.kernel.org/lpc-bpf.html#session-8 DPDK documentation, Berkeley Packet Filter Library http://doc.dpdk.org/guides/prog_guide/bpf_lib.html Nothing yet on libkefir… Stay tuned! Q. Monnet | Unifying network filtering rules for the Linux kernel with eBPF 22/22