From: gmcgraw at udel dot edu Operating system: Linux PHP version: 5.4.14 Package: SNMP related Bug Type: Bug Bug description:Some IPv6 addresses get interpreted wrong
Description: ------------ PHP sends the following string to Net-SNMP to parse as an address: "udp6:fc00::23:250:56ff:fe82:3177" Net-SNMP understands the final part of the IP address to be a port number, since it has no hexadecimal characters in it. There was an earlier bug filed and fixed in PHP 5.4 that involved IPv6 but that fix only partially addressed the issue (bug #42918). It made PHP correctly parse IPv6 address but it didn't ensure that PHP sent Net-SNMP a form of address that it will always correctly interpret. My patch causes square brackets to always surround the IPv6 address, so that Net-SNMP cannot possibly interpret the last part of the Ipv6 address as a port number. The port number will be placed outside the square brackets. Here is an example of how it will now send the IPV6 address to Net-SNMP: "udp6:[fc00::23:250:56ff:fe82:3177]" Or if there is a custom port number 1234: "udp6:[fc00::23:250:56ff:fe82:3177]:1234" Net-SNMP will correctly parse that and use the default SNMP port number (161) if none is specified or the provided port number otherwise. I have reproduced this in 5.4.1 and 5.4.14. Test script: --------------- $s=new SNMP(SNMP::VERSION_2C, '[fc00::23:250:56ff:fe82:3177]', 'public'); print_r($s->get('.1.3.6.1.2.1.1.1.0')); Expected result: ---------------- STRING: "Linux mykernel12345 #5 SMP Fri Jun 1 19:44:50 GMT 2012 x86_64" Actual result: -------------- Warning: SNMP::get(): No response from udp6:fc00::23:250:56ff:fe82:3177 in php shell code on line 1 -- Edit bug report at https://bugs.php.net/bug.php?id=64765&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64765&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64765&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64765&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64765&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64765&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64765&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64765&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64765&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64765&r=support Expected behavior: https://bugs.php.net/fix.php?id=64765&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64765&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64765&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64765&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64765&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64765&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64765&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64765&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64765&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64765&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64765&r=mysqlcfg