How jiabochao/udpi works
Project Type and Purpose
• This is a C-based plugin project (“udpi-plugin”) that extends the FD.io VPP (Vector Packet Processing) framework with a Universal Deep Packet Inspection engine.
• Its primary purpose is to integrate Hyperscan-powered regex matching into VPP, enabling high-performance DPI for IPS/IDS and web-firewall use cases.
File Structure Analysis
• Top-level build and config:
• CMakeLists.txt, Makefile, cmake/ (helper modules), scripts/ (build checks)
• Core source:
• src/ – C implementation of DPI API (dpi.c, dpi_api.c, dpi_node.c), CLI interface (dpi_cli.c), SSL protocol module (protocols/dpi_ssl.c), API headers (dpi.h, dpi.api), and documentation (dpi_plugin_doc.md).
• Packaging:
• INFO.yaml, RELEASE.md, patches under root for distribution packaging.
Key Components
a. Host Operating System
– Linux kernel with DPDK drivers (uio, vfio) and hugepages configured.
b. VPP Core Engine
– Runs as a process or service; provides packet I/O, DPDK device binding, plugin loader, and binary API framework.
c. udpi Plugin
– Implements VPP plugin interface (src/dpi*.c), registers DPI graph node(s) into VPP’s packet-processing graph, exposes CLI and binary API commands.
d. DPI Engine
– Hyperscan library for regex matching; linked by udpi plugin.
e. Configuration Interfaces
– VPP CLI / binary API (udpi <commands>)
f. External Dependencies
– Hyperscan, VPP core libraries (libvppinfra, vpp-dev), optionally DPDK NIC drivers.
Relationships and Data Flow
• Packet Ingress: Network NIC → DPDK → VPP Core
• VPP Graph: Core’s packet-processing graph invokes the udpi graph node
• DPI Node: udpi plugin calls Hyperscan API for pattern matching
• Results: DPI verdict (match/no-match) fed back into VPP graph for forwarding, dropping, or alerting
• Control Plane: User CLI or external controller → VPP CLI/API → udpi plugin configuration
Architectural Patterns and Design Principles
• Plugin Architecture: The DPI logic is a dynamically loaded plugin leveraging VPP’s plugin interface.
• Data-Plane / Control-Plane Separation: Packet processing is in the fast path (data plane); configuration via CLI/API is in the control plane.
• Modular Protocol Extensions: The project includes protocol-specific modules (e.g., SSL in src/protocols).
• Build-Time Abstraction: CMake and Makefile orchestrate building against installed VPP or source tree.