Bug #64765 [Opn->Csd]: Some IPv6 addresses get interpreted wrong
| From: | lytboris@php.net | Date: | Fri, 03 May 2013 08:41:41 +0000 |
| Subject: | Bug #64765 [Opn->Csd]: Some IPv6 addresses get interpreted wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-178766@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64765&edit=1
ID: 64765
Updated by: lytboris@php.net
Reported by: gmcgraw at udel dot edu
Summary: Some IPv6 addresses get interpreted wrong
-Status: Open
+Status: Closed
Type: Bug
Package: SNMP related
Operating System: Linux
PHP Version: 5.4.14
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3828f6227b188bd0c8d829a375ebf51faf67c448
Log: Fix bug #64765 (enclose IPv6 address into square brackets)
Previous Comments:
------------------------------------------------------------------------
[2013-05-02 22:46:10] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64765&edit=1