Skip to content

[Nexthop] Guard getNonSflowSampledInterfacePort against an unconfigured management port#1377

Open
sazeed-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:guard-sflow-mirror-test-unconfigured-mgmt-port
Open

[Nexthop] Guard getNonSflowSampledInterfacePort against an unconfigured management port#1377
sazeed-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:guard-sflow-mirror-test-unconfigured-mgmt-port

Conversation

@sazeed-nexthop

Copy link
Copy Markdown

Summary

getNonSflowSampledInterfacePort() and getNonSflowSampledInterfacePortType() index masterLogicalPortIds({cfg::PortType::MANAGEMENT_PORT})[0] whenever the ASIC reports isSupported(HwAsic::Feature::MANAGEMENT_PORT). An ASIC can support the management-port feature while a given platform configures no management port, leaving that vector empty — so [0] dereferences past the end and the test crashes (SIGSEGV) during setup.

Fix

Guard the management-port branch with !empty() and fall back to masterLogicalInterfacePortIds()[0] — the same path already taken by platforms whose ASIC does not support a management port. On platforms that do configure a management port there is no behavior change.

Test Plan

On a Tomahawk5 / XGS platform that supports MANAGEMENT_PORT but configures none, the AgentSflowMirror* tests previously SIGSEGV'd at setup on both cold and warm boot; with this guard they pass. Platforms that configure a management port are unaffected.

…ent port

getNonSflowSampledInterfacePort() and getNonSflowSampledInterfacePortType()
index masterLogicalPortIds({PortType::MANAGEMENT_PORT})[0] whenever the ASIC
reports isSupported(HwAsic::Feature::MANAGEMENT_PORT). An ASIC can support the
management-port feature while a given platform configures no management port,
leaving that vector empty so [0] dereferences past the end and the test
crashes during setup.

Guard the management-port branch with !empty() and fall back to
masterLogicalInterfacePortIds()[0] -- the same path taken by platforms whose
ASIC does not support a management port.

Signed-off-by: sazeed-nexthop <sazeed@nexthop.ai>
@sazeed-nexthop
sazeed-nexthop requested a review from a team as a code owner July 13, 2026 03:49
@meta-cla meta-cla Bot added the CLA Signed label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant