[vpp] add plugins for CoPP dataplane enforcement - #281
nhegde-microsoft wants to merge 4 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Multi-model review: sonic-platform-vpp #281 (copp_punt_policer plugin)I ran this through a three model consensus review (Claude Opus, GPT, Grok, all at high reasoning) and then a second adversarial pass whose job was to disprove each finding. Every item below is grounded against the pinned VPP revision Blocker 1: startup.conf.tmpl never enables the native
|
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
@aaronber0614 Blocker 1: Fixed — added Blocker 2: Fixed — the node now calls Non-blocking notes: addressed all three — ELOG now gated on Will hold off claiming this is validated again until I've re-run the full suite against a real |
New VPP plugin classifying and rate-limiting control-plane traffic (ARP, LACP, LLDP, UDLD, TTL_ERROR) on the device-input feature arc. Conforming packets are delivered directly to each port's paired TAP interface. Enabled in docker-syncd-vpp's VPP startup config. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
The pinned VPP commit (3f9e978d7) includes upstream's 'policer: pluginify policer' refactor, which moved policer support from src/vnet/policer/ into its own out-of-tree-style plugin at src/plugins/policer/. This broke the CI build: fatal error: 'vnet/policer/policer.h' file not found Fix: - Update includes from <vnet/policer/policer.h> to <policer/policer.h> (the new location, matching how src/plugins/unittest/policer_test.c already references it). - The policer plugin's main-struct global (vnet_policer_main) is no longer directly linkable from an external plugin -- it's only extern-visible from inside the policer plugin itself (POLICER_PLUGIN_INTERNAL). External plugins must resolve it via the exported policer_get_main() accessor (a vlib_get_plugin_symbol() runtime lookup), same pattern policer_test.c uses. Switch both call sites and add a defensive null check, since the lookup can now legitimately fail (missing/not-yet-loaded policer plugin) where a direct global reference never could. Verified via a standalone syntax-only compile of both changed .c files against a clean checkout of the exact pinned VPP commit (3f9e978d7) -- 0 errors, only the pre-existing -Waddress-of-packed-member warnings already suppressed by the project's real build flags. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
- docker-syncd-vpp/conf/startup.conf.tmpl: enable policer_plugin.so.
The pinned VPP version loads policer as its own plugin (no longer
core vnet); without this, sonic-sairedis's policer_msg_id_base
lookup returns ~0 and aborts syncd at connect.
- copp_punt_policer_node.c: call policer_get_counters() +
vlib_increment_combined_counter() after computing the verdict, so
the VPP stats-segment counters (/net/policer/{conform,exceed,violate})
that SwitchVppPolicer.cpp's getPolicerStats() reads are actually
populated. vnet_police_packet() alone only updates the token bucket
and never touches these counters.
- copp_punt_policer_node.c: gate the per-packet ELOG call on
VLIB_NODE_FLAG_TRACE instead of firing unconditionally.
- copp_punt_policer.c: document the lack of a
vlib_worker_thread_barrier_sync() around the bind-table mutation --
the only caller in this environment is SONiC's syncd (single VAPI
client, main thread only), so this is unlikely to be an issue.
Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
Polices traffic destined to router-owned IPv4 addresses on the ip4-punt arc, ahead of ip4-punt-redirect -- a single global arc, so no per-interface binding is needed. Reuses VPP's existing policer objects. Signed-off-by: Nikhil Hegde <nikhilhegde@microsoft.com>
eba1b8f to
0a879f2
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
What
Two VPP plugins for CoPP dataplane enforcement:
copp_punt_policer: ARP/LACP/LLDP/UDLD/TTL_ERROR ondevice-input.copp_ip2me_policer(new): IP2ME/SNMP/SSH onip4-punt.Why
sonic-buildimage#25801. Ethertype-keyed traps never reach VPP's existing classify arcs on these
linux-cp-paired L3 ports. IP2ME/SNMP/SSH have no ethertype to match on and are keyed by destination IP after routing, so they need a separate policer path.How
copp_ip2me_policerregisters onip4-punt(global arc, reached only after routing decides a packet is host-bound — no per-interface binding needed). Tracks router-owned IPv4 addresses, meters matches via the existing SAI-created policer (vnet_police_packet()). Conform/unmatched →ip4-punt-redirect; exceed/violate →ip4-drop.Design: https://github.com/nhegde-microsoft/SONiC/blob/copp-vpp-enablement/doc/vpp/vpp_copp_HLD.md
Companion PRs
Test
vlab-vpp-01: all 24tests/copp/test_copp.pysubtests pass, zero skips.