Some IPv6 addresses get interpreted wrong
| Bug #64765 | Some IPv6 addresses get interpreted wrong | ||||
|---|---|---|---|---|---|
| Submitted: | 2013-05-02 22:46 UTC | Modified: | 2013-09-13 05:45 UTC | ||
| From: | gmcgraw at udel dot edu | Assigned: | lytboris (profile) | ||
| Status: | Closed | Package: | SNMP related | ||
| PHP Version: | 5.4.14 | OS: | Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2013-05-02 22:46 UTC] gmcgraw at udel dot edu
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
Patches
snmp-ipv6-patch (last revision 2013-05-03 00:53 UTC by gmcgraw at udel dot edu)Pull Requests
History
AllCommentsChangesGit/SVN commits
[2013-09-13 05:45 UTC] lytboris@php.net
[2014-10-07 23:19 UTC] stas@php.net
-Status: No Feedback +Status: Closed