php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36196 SNMP_VALUE_PLAIN appears not to be working
Submitted: 2006-01-29 00:24 UTC Modified: 2007-07-17 01:00 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:0 (0.0%)
From: pookey@php.net Assigned:
Status: No Feedback Package: SNMP related
PHP Version: 5.1.2 OS: gentoo linux
Private report: No CVE-ID: None
 [2006-01-29 00:24 UTC] pookey@php.net
Description:
------------
despite PHP and snmpwalk sharing the same library, they   
return different results for a query....   
   
# ldd /usr/bin/snmpwalk | grep snmp   
        libnetsnmp.so.5 => /usr/lib/libnetsnmp.so.5   
(0xb7ee6000)   
# ldd /usr/bin/php | grep snmp   
        libnetsnmp.so.5 => /usr/lib/libnetsnmp.so.5   
(0xb7616000)   
  
Bug #29998 covers this, but was dismissed - I am left 
wondering how despite using the same library, results 
differ.  According to the documentation, using the 
SNMP_VALUE_PLAIN  should prevent the displayed behaviour.  
 
Sorry if I'm missing something. 

Reproduce code:
---------------
# cat ./test.php
<?php
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo snmpget('reboot1', 'public', '.1.3.6.1.2.1.2.2.1.6.1') . "\n";



Expected result:
----------------
# snmpwalk -v 1 -c public  
reboot2 .1.3.6.1.2.1.2.2.1.6.1  
IF-MIB::ifPhysAddress.1 = STRING: 0:c0:b7:6a:c4:96  

Actual result:
--------------
# php ./test.php 
??jG 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-29 00:38 UTC] pookey@php.net
seems perl also works as expected...  
  
# cat ./test.pl   
#!/usr/bin/perl   
   
use Net::SNMP;   
use strict;   
   
my ($session, $error);   
( $session, $error ) = Net::SNMP->session(   
        -hostname       => 'reboot1',   
        -community      => 'public',   
        -timeout        => 5,   
        -port           => 161,   
        -localaddr      => '192.168.0.1',   
        -version        => 1,   
        );   
   
print $error;   
my $result =   
$session->get_request('.1.3.6.1.2.1.2.2.1.6.1');   
print $result->{'.1.3.6.1.2.1.2.2.1.6.1'};   
print "\n";   
  
# ./test.pl   
0x00c0b76a8747
 [2006-12-19 15:54 UTC] cesarmata2000 at cantv dot net
Test with that

<?php
//Bug #36196  	SNMP_VALUE_PLAIN
snmp_set_valueretrieval(0);
$mac = snmpget("192.168.0.1",'public',".1.3.6.1.2.1.2.2.1.6.x");
snmp_set_valueretrieval(1);

$mac = str_replace('""',"&nbsp;",$mac);
$mac = str_replace('Hex: ',"",$mac);
$mac = str_replace(' ',":",trim($mac));

print $mac;
?>
 [2007-07-09 13:43 UTC] jani@php.net
Try the above script. And also check the sources, perhaps you misunderstood how this works..
 [2007-07-09 13:43 UTC] jani@php.net
Also, update to latest 5.2 CVS first. :)
 [2007-07-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC