Req #42918 [Com]: IPv6 addresses not supported in SNMP extension

From: Date: Wed, 14 Apr 2010 12:39:09 +0000
Subject: Req #42918 [Com]: IPv6 addresses not supported in SNMP extension
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-149560@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=42918&edit=1 ID: 42918 Comment by: j dot ek at gmx dot net Reported by: estesp at fastmail dot us Summary: IPv6 addresses not supported in SNMP extension Status: Open Type: Feature/Change Request Package: Feature/Change Request Operating System: Linux PHP Version: 5CVS-2007-10-10 (snap) New Comment: Actually the code mentioned above occurs two times. First time in function "php_snmpv3" (for SNMPv3) and second in "php_snmp" (for v1 and v2c). It also seems that some other things should be updated to support IPv6 addresses, e.g. not only support IpAddress SMIv2 Base Type but also the more generic address schema described in RFC3291. On the other hand I cannot say whether the net-snmp library already does support this, but as they claim to be fully IPv6 compatible, it's worth a try. Previous Comments: ------------------------------------------------------------------------ [2007-10-10 14:39:20] estesp at fastmail dot us 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 this bug report at http://bugs.php.net/bug.php?id=42918&edit=1

« previous php.bugs (#149560) next »