Skip to content

Announcement filter: tc-BPF on the tunnel egress instead of XDP - #9

Merged
Vadims06 merged 11 commits into
feat/watcher-onboardingfrom
feat/tc-announcement-filter
Oct 24, 2026
Merged

Vadims06 merged 11 commits into
feat/watcher-onboardingfrom
feat/tc-announcement-filter

Conversation

@Vadims06

Copy link
Copy Markdown
Owner

Replaces the XDP announcement filter with a tc-BPF program on the egress of gre1 inside the watcher's namespace. Stacked on #8.

What changes

  • Where it runs: the filter node joins the FRR namespace (network-mode: container:router) instead of the host network, and sees the IS-IS PDU before GRE encapsulation.
  • What passes: Hellos, CSNP, PSNP with valid lengths; only fragment 0 of the watcher's own LSP, with at most one IS neighbour and the tunnel prefix as its only IP reachability. Other systems' LSPs, pseudonode LSPs, foreign prefixes and malformed PDUs are dropped.
  • Fail closed: the filter node brings gre1 up after attaching. If it fails, the tunnel stays down and no adjacency forms.
  • Off by default. Turn on with --action enable_filter, off with --action disable_filter.
  • Renamed, no aliases: xdp/ → filter/, image vadims06/isis-filter:v1 (published), answers key is_filter_enabled.

Checked

  • filter/test/run.sh: 53 PDU cases through bpftool prog run, including a captured FRR LSP.
  • tests/: 20 passed.
  • Live lab with a real gre1: adjacency Up; a loopback 8.8.8.8/32 in IS-IS on the watcher never reaches the device; a failed filter node leaves gre1 down.

Known limits

  • A device that rebooted cannot get other systems' LSPs from the watcher.
  • containerlab does not report a failed filter node; the sign is gre1 down and the filter container Exited (1).

Policy, counters and commands: README, "Listen-only mode".

Replaces the XDP files with a tc classifier built per watcher at container
start (-D defines from env), so plain iproute2 attaches it without bpffs or
SYS_ADMIN. The classifier is a stub that passes everything; the harness
fails 34 of 44 cases against it.
Hellos and CSNP/PSNP pass. An LSP passes only with the watcher's system id and
pseudonode 0, at most one point-to-point neighbour and, as reachability, only
the tunnel prefix. Anything malformed, truncated or unknown is dropped.
The PDU is read relative to the network header and bounded by its own length
and each TLV length, so a trailer is never parsed. Per-reason drop counters
replace bpf_printk.

All 44 verdict cases of the harness pass.
…LSP to the cases

The lab node that brings gre1 up ran in parallel with the one-shot filter node
(a node's create stage ends when its container starts), so FRR's first hello
and LSP left unfiltered. The attach step now sets the link up itself.
Verified on a live gre1: the link came up after the filter was attached.
enable_xdp/disable_xdp become enable_filter/disable_filter (no aliases), the
image is vadims06/isis-filter pinned as v1, the answers key and manifest field
is enable_filter (on by default for GRE). The node now shares the FRR network
namespace with NET_ADMIN, BPF and PERFMON instead of host networking, gets the
watcher system id and tunnel subnet from client.py as env, and replaces h2.
run_command calls the class method: the enable_filter attribute would shadow it,
which already made the old enable_xdp action fail. The veth MTU comment is
corrected: FRR needs 1497 on gre1 for its LSP size, with or without a filter.
…dows the enable_filter action

Reverts the class-level lookup in run_command, which the rename makes unneeded.
…tcher

The prompt and the manifest default are off. cap-add is dropped from the template:
containerlab runs nodes privileged, so the list restricted nothing and older
Docker or kernels do not know CAP_BPF. Files are announcement_filter.c,
attach_filter.sh and filter/test/ like in the OSPF watcher.
h2 is removed when the filter is on, so the watcher's wait-for pointed at a node that no longer exists.
…control PDU lengths

A per-TLV neighbour limit let two TLVs each carry a different neighbour, and
fragments cannot be correlated, so only fragment 0 of the own LSP leaves and
the neighbour count spans all IS-reach TLVs. Hellos and SNPs pass only with the
header length of their type and a PDU length that fits the packet.
A PSNP with no TLVs is exactly 17 bytes, so the unconditional 19-byte read dropped a valid one.
@Vadims06
Vadims06 merged commit 8de7524 into feat/watcher-onboarding Oct 24, 2026
2 checks passed
@Vadims06
Vadims06 deleted the feat/tc-announcement-filter branch October 24, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant