← Back to Pull requests

lib: add a REJECT verdict for XDP #646

Open
unknown opened this pull request with 236 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 13, 2026 18:10 UTC
Author

Summary

Adds a terminal, rule-only REJECT verdict for XDP chains. IPv4 packets get an ICMP port unreachable (type 3 code 3) and IPv6 packets an ICMPv6 port unreachable (type 1 code 4), built in place by two new ELF stubs and sent back with XDP_TX. The reply type is stored per rule (rule.reject_type, port-unreachable by default) with a per-type table in xdp.c, so other reject types can be added later. Packets the kernel’s icmp_send() wouldn’t answer (non-first fragments, ICMP errors, broadcast/multicast, malformed headers) are dropped instead. Other hooks refuse the verdict at load time, like REDIRECT.

Related issue

Fixes #565

Testing

Built in ghcr.io/meta/bpfilter:fedora-44-x64 on a KVM VM (kernel 6.8): unit 25/25, e2e 106/106, integration 3/3, check 5/5, and the docs build with no warnings. The new REJECT e2e tests also pass on 6.6.162 with the virtme-ng harness. Through a veth, ping and ping -6 print “Destination Port Unreachable” and “Destination unreachable: Port unreachable”, and UDP/TCP clients get ECONNREFUSED.

Notes for the reviewer

  • bfcli only accepts a bare REJECT for now. What syntax would you like for picking another type later, e.g. REJECT tcp-reset?

  • The destination MAC isn’t compared with the interface’s, so on a promiscuous or bridge-port interface, frames for other hosts also get a reply (nft’s netdev reject does the same). Is that OK, or should the chain capture the device MAC?
  • AI disclosure

    Code drafted by both human and AI, and reviewed by human.

    Checklist

  • I understand every line in this PR and can explain why it is correct

  • I built the project and ran the tests covering this change

  • make -C $BUILD test passes and the code follows the style guide

  • Commits are formatted as component: subcomponent: short description

  • I have disclosed any AI usage above
  • Diff: 236 lines (+177 / -59) across 2 files Reviewer: JonSnow1807 Review duration: 22271m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 236 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.327
    Real PR Conversation Timeline
    1 comments
    "Review active on #646"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.8% · Safe to merge
    19.8%
    Repository