From:             estesp at fastmail dot us
Operating system: Linux
PHP version:      5CVS-2007-10-10 (snap)
PHP Bug Type:     SNMP related
Bug description:  IPv6 addresses not supported in SNMP extension

Description:
------------
The snmp interface code in php5 does not properly support IPv6 addresses
for the hostname.  Since net-snmp 5.x the SNMP daemon can be listening on
udp6 port and therefore, the hostname passed could be a valid IPv6
address.

However, the code in the snmp extension has:

     if ((pptr = strchr (hostname, ':'))) {
                remote_port = strtol (pptr + 1, NULL, 0);
        }

So, instead of defaulting to the usual (default) snmp port, given an IPv6
address, it is taking everything past the first colon as the port number..
which, I believe is going to give a very interesting port number for most
IPv6 addresses :)

Reproduce code:
---------------
Just call snmpget() with an IPv6 IP address.. you will get a host not
found, or similar:

$host = '0000:0000:0000:0000:0000:0000:0000:0001';
$community = 'public';
$sysName = snmpget($host, $community, "system.sysName.0");
print "$sysName

Expected result:
----------------
snmpget() should work for IPv6 addresses given you have a net-snmp version
with IPv6 support and have snmpd listening on an IPv6 transport.

Actual result:
--------------
PHP Warning:  snmpget(): Could not open snmp connection: Unknown host
(0000:0000:0000:0000:0000:0000:0000:0001) in /my_ipv6_php on line 4

There may be other issues here as "unknown host" sounds like a getaddrinfo
problem, but since doing an snmpget on the server in Ipv6 mode outside of
php5 works, I have to bet that something in the snmp interface in php5 is
broken with respect to IPv6.

-- 
Edit bug report at http://bugs.php.net/?id=42918&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42918&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42918&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42918&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42918&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42918&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42918&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42918&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42918&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42918&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42918&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42918&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42918&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42918&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42918&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42918&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42918&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42918&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42918&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42918&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42918&r=mysqlcfg

Reply via email to