Skip to content

[draft] calicovppctl: add HTTP capture server for BPF filtering with binary API support#862

Draft
aritrbas wants to merge 3 commits intomasterfrom
abasu-calicovppctl-server
Draft

[draft] calicovppctl: add HTTP capture server for BPF filtering with binary API support#862
aritrbas wants to merge 3 commits intomasterfrom
abasu-calicovppctl-server

Conversation

@aritrbas
Copy link
Collaborator

Capture Server (calico-vpp-agent/capture/capture_server.go):

  • HTTP server running on port 9999 (configurable via CaptureServerPort)
  • Endpoints: /api/status, /api/trace, /api/pcap, /api/dispatch, /api/stop
  • Handles timeouts and user conflicts via mutex-based single-instance execution
  • Handles client disconnect to cleanup captures
  • Uses vpplink binary API for stability instead of vppctl CLI

vpplink API additions:

  • vpplink/bpf.go: BPF filter management via binary API
  • vpplink/tracedump.go: trace capture and dump via binary API
  • Generated bindings for bpf_trace_filter and tracedump

calicovppctl updates:

  • Added --use-api flag to use the capture server instead of vppctl commands via kubectl exec for trace, pcap and dispatch
  • Added 'capture status' subcommand to check capture status
  • Added 'capture stop' subcommand to stop running captures

config updates:

  • Added CaptureServerPort configuration option (default: 9999)

Aritra Basu added 2 commits January 8, 2026 13:42
- Add CLI flags: -srcip, -dstip, -srcport, -dstport, -protocol
- Implement BPF filter building and application using VPP CLI
- Handle empty capture files gracefully
- Support BPF filtering for trace, pcap, and dispatch commands

Signed-off-by: Aritra Basu <aritrbas@cisco.com>
- Serialize capture operations (trace/pcap/dispatch) per VPP pod
  using an in-pod lock file (/tmp/calicovppctl.lock), preventing
  parallel captures from multiple clients
- Provide clear error output when a capture is already running
- Add forced cleanup option: `calicovppctl capture clear -node <node>`
  - clears trace
  - stops `pcap trace` and `pcap dispatch trace`
  - clears BPF filters and restores default filter functions
  - removes hanging in-pod lock file

Signed-off-by: Aritra Basu <aritrbas@cisco.com>
@aritrbas aritrbas self-assigned this Jan 10, 2026
@aritrbas aritrbas changed the title Add HTTP capture server for BPF filtering with binary API support [draft] calicovppctl: add HTTP capture server for BPF filtering with binary API support Jan 10, 2026
Capture Server (calico-vpp-agent/capture/capture_server.go):
- HTTP server running on port 9999 (configurable via CaptureServerPort)
- Endpoints: /api/status, /api/trace, /api/pcap, /api/dispatch, /api/stop
- Handles timeouts and user conflicts via mutex-based single-instance execution
- Handles client disconnect to cleanup captures
- Uses vpplink binary API for stability instead of vppctl CLI

vpplink API additions:
- vpplink/bpf.go: BPF filter management via binary API
- vpplink/tracedump.go: trace capture and dump via binary API
- Generated bindings for bpf_trace_filter and tracedump

calicovppctl updates:
- Added --use-api flag to use the capture server instead of vppctl
  commands via kubectl exec for trace, pcap and dispatch
- Added 'capture status' subcommand to check capture status
- Added 'capture stop' subcommand to stop running captures

config updates:
- Added CaptureServerPort configuration option (default: 9999)
@aritrbas aritrbas force-pushed the abasu-calicovppctl-server branch from d391f4e to 525a10a Compare January 10, 2026 01:01
Base automatically changed from abasu-filter to master January 29, 2026 15:03
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