Skip to content

Commit d391f4e

Browse files
author
Aritra Basu
committed
Add HTTP capture server for BPF filtering with binary API support
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)
1 parent fed6073 commit d391f4e

File tree

12 files changed

+2610
-16
lines changed

12 files changed

+2610
-16
lines changed

calico-vpp-agent/capture/capture_server.go

Lines changed: 668 additions & 0 deletions
Large diffs are not rendered by default.

calico-vpp-agent/cmd/calico_vpp_dataplane.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"k8s.io/client-go/kubernetes"
3535
"k8s.io/client-go/rest"
3636

37+
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/capture"
3738
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/cni"
3839
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/common"
3940
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/connectivity"
@@ -162,6 +163,7 @@ func main() {
162163
}
163164
connectivityServer := connectivity.NewConnectivityServer(vpp, felixServer, clientv3, log.WithFields(logrus.Fields{"subcomponent": "connectivity"}))
164165
cniServer := cni.NewCNIServer(vpp, felixServer, log.WithFields(logrus.Fields{"component": "cni"}))
166+
captureServer := capture.NewCaptureServer(vpp, log.WithFields(logrus.Fields{"component": "capture"}))
165167

166168
/* Pubsub should now be registered */
167169

@@ -263,6 +265,7 @@ func main() {
263265
Go(routingServer.ServeRouting)
264266
Go(serviceServer.ServeService)
265267
Go(cniServer.ServeCNI)
268+
Go(captureServer.ServeCapture)
266269

267270
// watch LocalSID if SRv6 is enabled
268271
if *config.GetCalicoVppFeatureGates().SRv6Enabled {

0 commit comments

Comments
 (0)