Fixed parse escaped value with space at end of string#12
Open
stupalov wants to merge 1 commit into
Open
Conversation
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
Fixed parsing of escaped
.snmprecvalues that end with a significant space character. The parser used to strip the whole record before splitting fields, so a trailing space in the value field was lost before escaped value evaluation.Problem
For some escaped values, snmpsim fails with an error like:
For example, this request returns an IP address whose last byte can be encoded as a trailing space in the escaped
.snmprecvalue:Relevant part of
loadmaster.snmprec:In the last line, the space at the end of the value is significant and should be converted to number 32. This change trims only OID/tag whitespace and record terminators from the value, preserving the trailing value space.
Tests
.venv/bin/python -B -m pytest testsResult:
2 passed, 5 skipped.Ported from stupalov@a1275f9