v1.10.3 · Apache‑2.0 · Linux · C/C++

See the traffic.
Understand the signal.

Link libmmt_core, register the protocol fields you need, and process packets from a pcap or a live interface. MMT‑DPI classifies 677 protocols, extracts 7,530 typed attributes, and tracks per-flow sessions — all behind one callback API.

install once, then a first run in three commands
# 1 — install the library (every Linux; the other routes are under Install)
$ curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | bash
# 2 — in an empty directory, get the source and the capture
$ curl -fsSL -O https://montimage.github.io/mmt-dpi/first-run/hello_packet.c \
-O https://montimage.github.io/mmt-dpi/first-run/traffic.pcap
# 3 — compile it against libmmt_core (needs gcc and libpcap-dev / libpcap-devel)
$ gcc -o hello_packet hello_packet.c \
-I /opt/mmt/dpi/include -L /opt/mmt/dpi/lib -lmmt_core -ldl -lpcap
# 4 — run it on the capture
$ ./hello_packet traffic.pcap
packet 1: 71 bytes, meta.ethernet.ip.udp.dns
packet 6: 130 bytes, meta.ethernet.ip.tcp.http
10 packets processed
677
protocols classified
7,530
named attributes
5G
LTE & mobile core
// the problem

Traffic moved on. Most parsers didn't.

Fixed-protocol tools can't follow traffic as it shifts to QUIC, HTTP/2, and 5G control planes. Hand-rolled parsers turn every new protocol into a brittle byte-offset rewrite — and they fall over on malformed or fragmented input.

[ 0x ]

Offset math everywhere

Every field is a hardcoded slice. One spec change, one option flag, and your parser silently returns garbage.

[ ✕ ]

Blind to modern transports

QUIC, HTTP/2, DTLS, 5G NAS/NGAP. If your stack can't classify them, half your traffic is "unknown."

[ ⚠ ]

Breaks under fragmentation

Out-of-order, overlapping, duplicated segments, IP fragmentation evasion — the cases that matter most are the ones that crash naive code.


// the engine

One engine you query by name.

Register the fields you care about by (protocol, attribute). The engine classifies every packet, extracts your fields, reassembles sessions, and calls you back — battle-tested across a decade of Montimage monitoring products.

  • Protocol Classification - Automatic identification and classification of network traffic across 677 protocols
  • Attribute Extraction - Extract detailed protocol-specific fields (IPs, ports, headers, payloads, etc.)
  • Session Tracking - Track and analyze network sessions with flow-level statistics (RTT, retransmissions, byte/packet counts)
  • Extensible Plugin Architecture - Add new protocol support via modular plugins
  • Wide Protocol Coverage - TCP/IP stack, HTTP/HTTP2, QUIC (RFC 9000), DNS, FTP, DTLS, GTP, MQTT, OSPF, RADIUS, DICOM, syslog (RFC 3164/5424), PTP, and more
  • 5G/LTE Mobile Protocols - NAS, S1AP, NGAP, GTPv2, Diameter for mobile network monitoring
  • Linux-Based - Supports major Linux distributions (Debian/Ubuntu, Rocky Linux/CentOS Stream, Fedora, openSUSE; Arch, Alpine and RHEL best-effort)

// coming in 1.10.0 (unreleased)

See into encrypted and tunneled traffic.

1.10.0 is not tagged yet; the install below still delivers the current release. Here is what it adds, from its changelog.

[ tls / quic ]

SNI, ALPN and JA4 from the first flight

A TLS ClientHello split over several TCP segments is reassembled before it is read. QUIC v1 and v2 client Initials are decrypted in-tree, with no third-party crypto library, so QUIC flows yield the same SNI, ALPN and JA4 fingerprint as TLS.

[ tunnels ]

Down to the inner flow

MPLS label stacks, VXLAN, GENEVE and PPPoE are walked to the flow they carry, and a GTP-U payload is identified as IPv4, IPv6 or Ethernet instead of being assumed to be IPv4.

[ verdicts ]

Know how each flow was classified

meta.classification_method reports whether a verdict came from a payload match, a hostname, a correlation, an IP range or a port guess. Four weak signatures, among them DICOM and version-less gQUIC, now need corroboration before they claim a flow.

[ measured ]

Faster, leaner, harder to break

Against Montimage/mmt-dpi main (af338b16), same aarch64 host: about 2.3–2.5× the packets per second on bigFlows.pcap with no attribute fetched, 56% less library memory, and 0 sanitizer findings on 2,011 hostile inputs, against 100. Method and raw data →

Every library's SONAME moves to lib<name>.so.1: rebuild consumers and plugins once when you upgrade.


// the api

From one attribute to live session analysis — in real code.

The same four calls scale from a five-line program to a live probe. Pick a tier — every snippet compiles against libmmt_core (link with -lmmt_core -ldl -lpcap).

hello_packet.c

A complete first program, hello_packet.c, and a small capture to run it on, traffic.pcap, are published with the documentation site. From an empty directory, with the SDK installed under /opt/mmt (the quick-start default — substitute your MMT_BASE prefix and add LD_LIBRARY_PATH="$MMT_BASE/dpi/lib" to the run line otherwise). Compiling needs gcc and the libpcap headers: the source installer adds both; after a .deb/.rpm install, add them with sudo apt-get install gcc libpcap-dev (Debian/Ubuntu) or sudo dnf --enablerepo=crb install gcc libpcap-devel (Rocky, AlmaLinux and CentOS Stream 9, where libpcap-devel is in CRB; on RHEL 9 first run sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms and drop --enablerepo=crb; plain dnf install on Fedora):

curl -fsSL -O https://montimage.github.io/mmt-dpi/first-run/hello_packet.c \
     -O https://montimage.github.io/mmt-dpi/first-run/traffic.pcap
gcc -o hello_packet hello_packet.c -I /opt/mmt/dpi/include -L /opt/mmt/dpi/lib -lmmt_core -ldl -lpcap
./hello_packet traffic.pcap

The capture is synthetic and redistributable: one DNS lookup and one HTTP exchange between documentation addresses (RFC 5737). The program prints each packet’s size and the protocol path MMT-DPI classified it as — the TCP handshake stays unknown until the first payload identifies HTTP:

packet 1: 71 bytes, meta.ethernet.ip.udp.dns
packet 2: 87 bytes, meta.ethernet.ip.udp.dns
packet 3: 54 bytes, meta.ethernet.ip.tcp.unknown
packet 4: 54 bytes, meta.ethernet.ip.tcp.unknown
packet 5: 54 bytes, meta.ethernet.ip.tcp.unknown
packet 6: 130 bytes, meta.ethernet.ip.tcp.http
packet 7: 138 bytes, meta.ethernet.ip.tcp.http
packet 8: 54 bytes, meta.ethernet.ip.tcp.http
packet 9: 54 bytes, meta.ethernet.ip.tcp.http
packet 10: 54 bytes, meta.ethernet.ip.tcp.http
10 packets processed

A missing capture fails with a clear message and the command that fetches it. The program follows the embedding lifecycle — global init, one handler, a packet_process() loop, handler teardown before the global teardown; the src/examples/packet_handler.c reference that CI compiles on every build does the same. META/PACKET_LEN is a built-in meta attribute available on every packet:

/* hello_packet.c - a first MMT-DPI program: print the size and the
 * classified protocol path of every packet in a capture.
 *
 * Build against an installed SDK (replace /opt/mmt with your MMT_BASE):
 *   gcc -o hello_packet hello_packet.c -I /opt/mmt/dpi/include \
 *       -L /opt/mmt/dpi/lib -lmmt_core -ldl -lpcap
 * Run on the sample capture published next to this file:
 *   ./hello_packet traffic.pcap
 */
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <pcap.h>
#include "mmt_core.h"

static int on_packet(const ipacket_t *ipacket, void *user_args) {
    uint32_t *len = (uint32_t *)get_attribute_extracted_data_by_name(
        ipacket, "META", "PACKET_LEN");
    char path[256] = "";
    (void)user_args;
    proto_hierarchy_to_str_with_size(ipacket->proto_hierarchy, path, sizeof(path));
    printf("packet %" PRIu64 ": %u bytes, %s\n", ipacket->packet_id,
           len ? *len : 0, path);
    return 0; // returning 1 skips the remaining handlers for this packet
}

int main(int argc, char **argv) {
    char errbuf[PCAP_ERRBUF_SIZE > MMT_ERRBUF_SIZE ? PCAP_ERRBUF_SIZE : MMT_ERRBUF_SIZE];
    if (argc != 2) {
        fprintf(stderr, "usage: %s <capture.pcap>\n", argv[0]);
        return 1;
    }
    // Open the capture first: a missing file needs no MMT state to report.
    pcap_t *pcap = pcap_open_offline(argv[1], errbuf);
    if (!pcap) {
        fprintf(stderr, "hello_packet: cannot open capture '%s': %s\n", argv[1], errbuf);
        if (strcmp(argv[1], "traffic.pcap") == 0) // only the sample has a download
            fprintf(stderr, "  to fetch the sample capture into the current directory:\n"
                    "  curl -fsSLO https://montimage.github.io/mmt-dpi/first-run/traffic.pcap\n");
        return 1;
    }
    if (pcap_datalink(pcap) != DLT_EN10MB) {
        fprintf(stderr, "hello_packet: '%s' is not an Ethernet capture\n", argv[1]);
        pcap_close(pcap);
        return 1;
    }

    // 1. global state, once, before any handler
    if (!init_extraction()) {
        fprintf(stderr, "hello_packet: init_extraction failed\n");
        pcap_close(pcap);
        return 1;
    }
    // 2. one handler for this packet stream
    mmt_handler_t *handler = mmt_init_handler(DLT_EN10MB, 0, errbuf);
    if (!handler) {
        fprintf(stderr, "hello_packet: handler init failed: %s\n", errbuf);
        close_extraction();
        pcap_close(pcap);
        return 1;
    }
    // 3. register what to extract and the per-packet callback
    struct pcap_pkthdr *pkt_hdr;
    const u_char *data;
    unsigned long count = 0;
    int rc, status = 1;
    if (!register_extraction_attribute_by_name(handler, "META", "PACKET_LEN")
        || !register_packet_handler(handler, 1, on_packet, NULL)) {
        fprintf(stderr, "hello_packet: registration failed\n");
        goto out;
    }
    // 4. the processing loop: one packet_process() call per captured packet
    while ((rc = pcap_next_ex(pcap, &pkt_hdr, &data)) == 1) {
        struct pkthdr header;
        memset(&header, 0, sizeof(header));
        header.ts = pkt_hdr->ts;
        header.caplen = pkt_hdr->caplen;
        header.len = pkt_hdr->len;
        if (!packet_process(handler, &header, data))
            fprintf(stderr, "hello_packet: packet %lu not processed\n", count + 1);
        count++;
    }
    if (rc == -1) {
        fprintf(stderr, "hello_packet: read error: %s\n", pcap_geterr(pcap));
        goto out;
    }
    printf("%lu packets processed\n", count);
    status = 0;
out:
    // 5. every handler before the global teardown, which comes last
    mmt_close_handler(handler);
    close_extraction();
    pcap_close(pcap);
    return status;
}

The handler returns int (the callback contract) — returning 1 skips the remaining handlers for that packet.

extract_fields.c
#include "mmt_core.h"

int on_packet(const ipacket_t *ipacket, void *args) {
    uint32_t *src  = get_attribute_extracted_data_by_name(ipacket, "ip",   "src");
    uint32_t *dst  = get_attribute_extracted_data_by_name(ipacket, "ip",   "dst");
    uint16_t *port = get_attribute_extracted_data_by_name(ipacket, "tcp",  "dest_port");
    mmt_header_line_t *host = get_attribute_extracted_data_by_name(ipacket, "http", "host");

    if (src && dst && port) {
        uint8_t *s = (uint8_t*)src, *d = (uint8_t*)dst;   // IP = 4 octets, net order
        // host is an mmt_header_line_t (ptr + len) — not a null-terminated string.
        printf("%u.%u.%u.%u → %u.%u.%u.%u:%u  %.*s\n",
               s[0],s[1],s[2],s[3], d[0],d[1],d[2],d[3], *port,
               host ? (int)host->len : 1, host ? host->ptr : "-");
    }
    return 0;
}

int main(void) {
    init_extraction();
    char errbuf[1024];
    mmt_handler_t *h = mmt_init_handler(DLT_EN10MB, 0, errbuf);

    // Register the fields you care about — by (protocol, attribute) name.
    register_extraction_attribute_by_name(h, "ip",   "src");
    register_extraction_attribute_by_name(h, "ip",   "dst");
    register_extraction_attribute_by_name(h, "tcp",  "dest_port");
    register_extraction_attribute_by_name(h, "http", "host");
    register_packet_handler(h, 1, on_packet, NULL);

    // ... same pcap / packet_process() loop as Tier 1 ...
}

Each attribute has a typed value — numeric fields come back as uint*_t*, while header strings like http/host are mmt_header_line_t* (a ptr+len pair, not null-terminated). Names map to MMT's 7,530 attributes; the engine classifies by payload signature, so these resolve regardless of port. See MMT-Attributes.

live_sessions.c
#include <pcap.h>
#include <inttypes.h>   // PRIu64
#include "mmt_core.h"

// Called periodically per active session — read flow-level stats.
void on_session(const mmt_session_t *s, void *args) {
    printf("session %"PRIu64": %"PRIu64" pkts, %"PRIu64" bytes\n",
           get_session_id(s),
           get_session_packet_count(s),
           get_session_byte_count(s));
}

// pcap delivers each frame straight into MMT.
void on_capture(u_char *user, const struct pcap_pkthdr *ph, const u_char *data) {
    mmt_handler_t *h = (mmt_handler_t*)user;
    struct pkthdr hdr = { .ts = ph->ts, .caplen = ph->caplen, .len = ph->len };
    packet_process(h, &hdr, data);
}

int main(int argc, char **argv) {
    if (argc != 2) {
        fprintf(stderr, "usage: %s <interface>\n", argv[0]);
        return 1;
    }
    char errbuf[MMT_ERRBUF_SIZE];   // large enough for pcap's errors too
    if (!init_extraction()) return 1;
    mmt_handler_t *h = mmt_init_handler(DLT_EN10MB, 0, errbuf);
    if (!h) {
        fprintf(stderr, "mmt_init_handler: %s\n", errbuf);
        close_extraction();
        return 1;
    }

    // Report each session on a timer (0 = include incomplete packets).
    register_session_timer_handler(h, on_session, NULL, 0);

    // Capture live from an interface and pump frames into MMT.
    pcap_t *pcap = pcap_open_live(argv[1], 65535, 1, 1000, errbuf);
    if (!pcap) {   // e.g. no capture permission: run with sudo
        fprintf(stderr, "pcap_open_live: %s\n", errbuf);
        mmt_close_handler(h);
        close_extraction();
        return 1;
    }
    pcap_loop(pcap, -1, on_capture, (u_char*)h);

    pcap_close(pcap);
    mmt_close_handler(h);
    close_extraction();
    return 0;
}

Session accessors expose packet/byte counts, uplink/downlink splits, and more. Built-in tcp/rtt and tcp/retransmission attributes add per-flow timing. Run live captures with sudo; a permission or loader error is explained in Troubleshooting.

Adding a protocol MMT doesn't cover yet is a library-level extension: a module implements init_proto_<name>_struct(), declares its fields, and registers with the core at build time — see Adding New Protocols. Full runnable examples live in src/examples/.


// coverage

From Ethernet to 5G, classified out of the box.

A selection of the 677 protocols MMT‑DPI recognizes — across the TCP/IP stack, application layer, mobile core, and industrial/OT.

TCPIPv4/IPv6HTTP HTTP/2QUICDNS TLS/DTLSFTPMQTT RTSPSMBRADIUS OSPFSCTPVLAN / 802.1ad 5G NGAPNASS1AP GTP / GTPv2DiameterSIP S7COMMCOTP / TPKTCDP / DTP DICOMSyslogPTPVNCMSSQL All 656 TCP/IP-plugin protocols →

// where it runs

The extraction layer under real systems.

[ nids ]

Intrusion detection & security monitoring

Feed classified, attribute-level events into detection engines. MMT-DPI powers Montimage's network security monitoring and IP-fragmentation evasion detection.

[ 5g ]

5G & mobile network analysis

Decode control-plane signaling (NGAP, NAS, S1AP, Diameter). Underpins 5GReplay, a 5G traffic fuzzer presented at ARES 2021.

[ iot ]

IoT & industrial monitoring

Classify OT/industrial protocols (S7COMM, COTP) and IoT traffic. Deployed in security-monitoring frameworks on Fed4Fire+ testbeds.

[ qoe ]

Traffic analytics & QoE

Session-level RTT, retransmissions, and per-flow counters give you the raw signals for quality-of-experience and performance analytics.

// proven in research & production

A decade of peer-reviewed work runs on this engine.

MMT-DPI is the data-extraction core of the wider Montimage Monitoring Tool (MMT) suite, cited and evaluated across DPI, IoT, 5G, and intrusion-detection research.

5GReplay: A 5G Network Traffic Fuzzer — Application to Attack Injection
ARES 2021 · [5g] [nids]
A Network Traffic Mutation Based Ontology to Expand the Training Set of AI-Based NIDS
IEEE Access, 2023 · [nids]
A Framework for Security Monitoring of Real IoT Testbeds
ICSOFT 2021 · [iot]
Online Network Traffic Security Inspection Using MMT Tool
System Testing & Validation, 2012 · [dpi-core]

See the full publication list →

// install & link

Get the library, then compile against it.

Install MMT-DPI with one command. The routes below are listed in order of preference: use the first one that covers your platform. Every route installs under /opt/mmt, so the first run works after any of them, from an empty directory.

Verified package bootstrap — Ubuntu 22.04/24.04/26.04, Debian 12/13, Rocky Linux / AlmaLinux 9 and 10, CentOS Stream 9 and 10, amd64 or arm64. It installs the release’s native .deb/.rpm after checking its sha256 and its build-provenance attestation. It is published with every release from v1.10.0 on.

curl -fsSL https://github.com/Montimage/mmt-dpi/releases/latest/download/install.sh | sh

Add -s -- --with-security after sh to install the GPL security engines too. To check the bootstrap before running it, download install.sh, run gh attestation verify install.sh --repo Montimage/mmt-dpi, then sh install.sh.

Source installer — every supported Linux. It installs the build dependencies, then clones the pinned release tag (v1.10.3), verifies it after checkout, builds it and installs it; moving branches are refused unless explicitly opted in:

curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | bash

or using wget:

wget -qO- https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | bash

The source installer and the first run are smoke-tested in CI on Ubuntu 22.04/24.04, Debian 12, Rocky Linux 9, CentOS Stream 9, Fedora 44 and openSUSE Leap 16.0. Arch, Alpine (musl: the SDK does not build there today) and RHEL itself (CodeReady Builder must be enabled through subscription-manager first) are best-effort. Its options are variants of the same command:

# Preview the install plan without changing anything
curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | bash -s -- --dry-run

# Install to a custom directory (substitute it for /opt/mmt in the first run)
curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | MMT_BASE=/usr/local/mmt bash

# Build the tip of a branch (here main) instead of the pinned release (unverified — explicit opt-in)
curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | BRANCH=main bash -s -- --unverified-branch

# Skip automatic dependency installation
curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | SKIP_DEPS=1 bash

# Uninstall (add --prefix <dir> for a custom prefix)
curl -fsSL https://raw.githubusercontent.com/Montimage/mmt-dpi/main/install.sh | bash -s -- --uninstall

Pre-built .deb/.rpm packages are on the Releases page; the full install walkthrough, building from a checkout included, is the User Guide.

Every route above installs to /opt/mmt/dpi (the command above the fold is the source installer's), and the first-run steps beside it compile and run the published hello_packet.c against that prefix. Prefer a package? Grab the .deb/.rpm from Releases; building from source is covered in the Compilation and Installation Instructions, and an error on the way — a missing header or library, the loader, the plugin directory, a permission — in Troubleshooting. Every guide lives in the documentation index.


// questions

Common questions

What exactly is MMT-DPI?

A high-performance C library for deep packet inspection. It classifies network traffic into 677 protocols and lets you extract 7,530 named, typed attributes from packets, server logs, and structured events — for real-time analysis. It's the extraction core inside the broader Montimage Monitoring Tool (MMT) suite. In the committed replay benchmark (one thread, one aarch64 host), bigFlows.pcap classifies at about 3.5 million packets per second with no attribute fetched and 3.0 million with eight fetched per packet, and the instruction-count gate fails a change that raises the replay's instructions per packet by more than 2%.

Which platforms are supported?

Linux only. The one-command install is smoke-tested in CI on Ubuntu, Debian, Rocky Linux, CentOS Stream, Fedora and openSUSE; Arch, Alpine and RHEL itself are best-effort. Builds with GCC or Clang, on x86-64 and natively on arm64 (aarch64). macOS and Windows are not currently supported.

How do I add a protocol that isn't covered?

Neither route touches the core engine. Add it to the bundled TCP/IP plugin — a row in proto_init_list.def, the protocol's id and class, and its classifier, then rebuild — as the Adding New Protocols guide walks through. Or build your own plugin: a shared library exporting init_proto(), which the engine loads at start-up from its plugins directory (MMT_DPI_PLUGINS_DIR overrides it).

Is it really free? What's the license?

Yes — MMT-DPI is open source under the Apache License 2.0. You can use it commercially, modify it, and ship it, subject to the license terms. No license keys, no usage caps.

Does it classify by port number?

Not by default. Classification is driven by payload signatures (with hostname- and IP-range-based methods), so it identifies protocols on non-standard ports and across modern transports. Port number is treated as the weakest signal — a last-resort hint consulted only after the signature-based methods return unknown, and only if you explicitly opt in with enable_port_classify() (disabled by default).

Can it handle fragmented or out-of-order traffic?

Yes. TCP reassembly (enable it per handler) reconstructs payloads across out-of-order, overlapping, and retransmitted segments, and the engine raises events for IP-fragmentation conditions — including evasion patterns like overlapping, duplicated, and too-many fragments.

Stop writing byte-offset parsers.
Start querying packets by name.

677 protocols, 7,530 attributes, plugin-extensible — open source under Apache-2.0. One command installs it; three more run your first program.