php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75782 SNMP Issue with backslash in OID
Submitted: 2018-01-09 01:02 UTC Modified: -
From: steve dot cleveland at oregonstate dot edu Assigned:
Status: Open Package: SNMP related
PHP Version: 7.2.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: steve dot cleveland at oregonstate dot edu
New email:
PHP Version: OS:

 

 [2018-01-09 01:02 UTC] steve dot cleveland at oregonstate dot edu
Description:
------------
When performing a walk on dot1dTpFdbAddress (.1.3.6.1.2.1.17.4.3.1.1) with an HP Procurve switch (it's a bridge between the port and the mac address table), I believe the PHP SNMP module is interpreting the response incorrectly when a backslash is in the OID.

I'm not sure how the dot1dTpFdbAddress 'names' are created or what exactly they represent, but in this case, it appears if the 'name' includes a backslash, PHP is assigning the name as the value.  I'm guessing it's an incorrect regex.

This is the first time I've run into this issue, so I think it's rare.  I've tried various output options (quick_print, enum_print, output_format and valueretrieval), but the value doesn't change.

I've tried both PHP versions 7.0.27 and 7.2.1

Test script:
---------------
# Command line snmpwalk command
% snmpwalk -v 2c -c public switch1 .1.3.6.1.2.1.17.4.3.1.1
BRIDGE-MIB::dot1dTpFdbAddress.'lbmP\=' = STRING: 6c:62:6d:50:5c:3d
BRIDGE-MIB::dot1dTpFdbAddress.'l.....' = STRING: 6c:f3:7f:c6:88:d6
BRIDGE-MIB::dot1dTpFdbAddress.'pM{&..' = STRING: 70:4d:7b:26:e3:4
BRIDGE-MIB::dot1dTpFdbAddress.'pZ....' = STRING: 70:5a:f:12:a2:11

# PHP either OOP or procedural
$snmp = new \SNMP(SNMP::VERSION_2c, 'switch1', 'public');
$snmp->walk('.1.3.6.1.2.1.17.4.3.1.1');
# or
snmp2_real_walk('switch1', 'public', '.1.3.6.1.2.1.17.4.3.1.1');

[SNMPv2-SMI::mib-2.17.4.3.1.1.108.98.109.80.92.61] => STRING: "lbmP\\="
[SNMPv2-SMI::mib-2.17.4.3.1.1.108.243.127.198.136.214] => Hex-STRING: 6C F3 7F C6 88 D6 
[SNMPv2-SMI::mib-2.17.4.3.1.1.112.77.123.38.227.4] => Hex-STRING: 70 4D 7B 26 E3 04 
[SNMPv2-SMI::mib-2.17.4.3.1.1.112.90.15.18.162.17] => Hex-STRING: 70 5A 0F 12 A2 11 


Expected result:
----------------
The first output in the example should return a MAC address, not lbmP\\=


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC