feat: add bounded SNMP walk - #172
Merged
Merged
Conversation
Contributor
Greptile SummaryAdds a bounded numeric SNMPv2c GETNEXT walk API.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security defects identified. The new API’s registration, static signature, protocol handling, limit look-ahead, deadline enforcement, resource accounting, and documented result contract remain internally consistent and are covered across their principal boundary conditions.
|
| Filename | Overview |
|---|---|
| src/stdlib/netmon.rs | Implements bounded walks, option validation, transport controls, response processing, completion semantics, and result construction without an identified actionable defect. |
| src/stdlib/netmon_codec.rs | Adds canonical GETNEXT encoding and stale-request classification while retaining BER, version, community, PDU, and status validation. |
| src/typechecker.rs | Adds a snmp_walk signature whose required and optional arguments agree with runtime registration. |
| tests/std_netmon_walk_tests.rs | Provides broad integration coverage for progression, completion boundaries, malformed responses, stale datagrams, limits, and policy checks. |
| docs/STDLIB_REFERENCE.md | Documents the new API and its result, completion, security, and resource-bound contracts consistently with the implementation. |
Sequence Diagram
sequenceDiagram
participant Program as NTNT Program
participant Walk as snmp_walk
participant Agent as SNMP Agent
Program->>Walk: target, auth, root OID, options
loop Until completion or limit
Walk->>Agent: GETNEXT(cursor)
Agent-->>Walk: Correlated response varbind
Walk->>Walk: Validate response, OID order, budgets, deadline
alt Terminal exception
Walk-->>Program: Complete result with terminal reason
else Outside subtree
Walk-->>Program: Complete result: out_of_subtree
else Look-ahead exceeds max_results
Walk-->>Program: Error or partial max_results result
else Ordinary in-subtree value
Walk->>Walk: Normalize value and advance cursor
end
end
Reviews (1): Last reviewed commit: "feat: add bounded SNMP walk" | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add bounded numeric SNMPv2c GETNEXT walks to the explicitly imported
std/netmonmodule and release the slice as v0.5.3.This PR is stacked on #171 (
docs/std-netmon-mib-catalogs). Its code remains numeric-only; MIB catalog parsing/resolution is deliberately deferred to the next implementation slice.API
The closed options map adds:
max_results: default 256, hard maximum 2,048on_limit:"error"(default) or"partial"Preflight enforces:
The extra logical request is the mandatory look-ahead used to distinguish exact completion from true truncation.
Safety and protocol contract
Secretcommunity, literal-IP target policy, process gate, private-target dual opt-in, connected UDP transport, and 8 KiB packet ceilings.Err(String)without prior-row telemetry for transport, protocol, ordering, deadline, packet, cumulative-byte, and output-budget failures.error_status=0/ nonzeroerror_indexcombinations for GET and WALK.Result shape
Successful results contain exactly:
targetaddressportversionroot_oidduration_msrequestsattemptscompletestop_reasonvaluesstop_reasonis one ofout_of_subtree,end_of_mib_view,no_such_object,no_such_instance, ormax_results.Tests
snmp_getregression coverage, including malformed status/index combinations.Validation
cargo fmt --allcargo nextest run --locked --no-fail-fast: 1,952/1,952clippy::op_refwarnings: cleangit diff --check: passRepo-wide
clippy -D warningsremains blocked locally by existing warnings outside this diff; this PR does not expand that debt.