Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass persist bug #826

Open
majorostamas opened this issue Jun 13, 2024 · 1 comment
Open

Pass persist bug #826

majorostamas opened this issue Jun 13, 2024 · 1 comment

Comments

@majorostamas
Copy link

majorostamas commented Jun 13, 2024

Hello,
I experienced the following issue. When I send this command:

snmpset -t 5 -v 3 -m NTCIP1218-v01 -l authPriv -u snmpPrivateTestUser -a SHA1 -A passWord2024Priv -x AES128 -X passWord2024Priv udp:192.168.11.97:161 rsuXmitMsgFwdingPsid.1 x 0020 rsuXmitMsgFwdingDestIpAddr.1 s "192.168.9.178" rsuXmitMsgFwdingDestPort.1 i 60001 rsuXmitMsgFwdingProtocol.1 i 2 rsuXmitMsgFwdingDeliveryStart.1 x 07E5031916010000 rsuXmitMsgFwdingDeliveryStop.1 x 07EE031916010000 rsuXmitMsgFwdingSecure.1 i 0 rsuXmitMsgFwdingStatus.1 i 4

Everything works fine, the following lines are received by my pass persist script:
set
.1.3.6.1.4.1.1206.4.2.18.20.2.1.2.1
octet "00 20"

But when I use 20 instead of 0020:

snmpset -t 5 -v 3 -m NTCIP1218-v01 -l authPriv -u snmpPrivateTestUser -a SHA1 -A passWord2024Priv -x AES128 -X passWord2024Priv udp:192.168.11.97:161 rsuXmitMsgFwdingPsid.1 x 20 rsuXmitMsgFwdingDestIpAddr.1 s "192.168.9.178" rsuXmitMsgFwdingDestPort.1 i 60001 rsuXmitMsgFwdingProtocol.1 i 2 rsuXmitMsgFwdingDeliveryStart.1 x 07E5031916010000 rsuXmitMsgFwdingDeliveryStop.1 x 07EE031916010000 rsuXmitMsgFwdingSecure.1 i 0 rsuXmitMsgFwdingStatus.1 i 4

Something goes wrong, the following lines are received by my pass persist script.
set
.1.3.6.1.4.1.1206.4.2.18.20.2.1.2.1
string " "

The root cause is that 20 is considered hexadecimal and it is converted to ASCII by net-snmp. ASCII 32 is the space character.

@fenner
Copy link
Member

fenner commented Jun 14, 2024

The pass infrastructure does not read the MIB to know the types of objects; it just passes along what was received on the wire. As you identified, there's ambiguity when the underlying type is an OCTET STRING, and so, net-snmp applies a heuristic: if the input is composed of all printable characters, then it uses string, otherwise it uses octet, to pass the data to the subprocess.

A pass-persist script should be prepared to receive either representation.

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

No branches or pull requests

2 participants