php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74642 snmprealwalk resets oid output format
Submitted: 2017-05-24 10:00 UTC Modified: 2017-06-12 06:31 UTC
From: mattias dot wallin at salanet dot se Assigned:
Status: Closed Package: SNMP related
PHP Version: 7.0.19 OS: Ubuntu 14.04 LTS
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: mattias dot wallin at salanet dot se
New email:
PHP Version: OS:

 

 [2017-05-24 10:00 UTC] mattias dot wallin at salanet dot se
Description:
------------
snmprealwalk with non numeric object_id resets oid output format for current call, and future calls.

Test script:
---------------
<?php
snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
print_r(snmprealwalk('1.2.3.4', 'public', '.1.3.6.1.2.1.17.2.15.1.3.1'));
print_r(snmprealwalk('1.2.3.4', 'public', 'BRIDGE-MIB::dot1dStpPortState.1'));
print_r(snmprealwalk('1.2.3.4', 'public', '.1.3.6.1.2.1.17.2.15.1.3.1'));
?>

Expected result:
----------------
Array
(
    [.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Array
(
    [.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Array
(
    [.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)

Actual result:
--------------
Array
(
    [.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: 5
)
Array
(
    [.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: forwarding(5)
)
Array
(
    [.1.3.6.1.2.1.17.2.15.1.3.1] => INTEGER: forwarding(5)
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-10 23:58 UTC] php at mcq8 dot be
Based on what you have in the expected result, you want to use snmp_set_enum_print(1) instead of snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC)?
The OIDs are in fact all numeric as expected in your example.
 [2017-06-12 06:31 UTC] mattias dot wallin at salanet dot se
-Status: Open +Status: Closed
 [2017-06-12 06:31 UTC] mattias dot wallin at salanet dot se
Yes, you are right.

I think i get how this confused me now..

When using snmprealwalk with numeric OID the MIB is not loaded, and therefore do not know about enum values.

Second call needs to load the MIB to parse the OID, which makes the enum values known and used for this and subsequent calls.

Using snmp_set_enum_print(0) do not change the actual result. But it is probably not a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC