Skip to content

Fixed parse escaped value with space at end of string#12

Open
stupalov wants to merge 1 commit into
lextudio:masterfrom
observium:preserve-snmprec-trailing-space
Open

Fixed parse escaped value with space at end of string#12
stupalov wants to merge 1 commit into
lextudio:masterfrom
observium:preserve-snmprec-trailing-space

Conversation

@stupalov

Copy link
Copy Markdown

Summary

Fixed parsing of escaped .snmprec values 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:

ERROR data error at loadmaster.snmprec controller for 1.3.6.1.2.1.3.1.1.3.3.1.85.209.202.31: value evaluation error for tag `64`, value [85, 209, 202]: Bad IP address syntax

For example, this request returns an IP address whose last byte can be encoded as a trailing space in the escaped .snmprec value:

$ snmpwalk -v2c -c community -Pu -M ../rfc:../net-snmp:. -m ALL hostname .1.3.6.1.2.1.3.1.1.3.3.1
RFC1213-MIB::atNetAddress.3.1.85.209.202.31 = Network Address: 55:D1:CA:1F
RFC1213-MIB::atNetAddress.3.1.85.209.202.31 = No more variables left in this MIB View (It is past the end of the MIB tree)

Relevant part of loadmaster.snmprec:

1.3.6.1.2.1.3.1.1.3.3.1.85.209.202.31|64e|U\xd1\xca\x1f
1.3.6.1.2.1.3.1.1.3.3.1.85.209.202.32|64e|U\xd1\xca 

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 tests

Result: 2 passed, 5 skipped.

Ported from stupalov@a1275f9

@CLAassistant

CLAassistant commented May 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants