php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64765
Patch snmp-ipv6-patch revision 2013-05-03 00:53 UTC by gmcgraw at udel dot edu
revision 2013-05-02 22:47 UTC by gmcgraw at udel dot edu

Patch snmp-ipv6-patch for SNMP related Bug #64765

Patch version 2013-05-02 22:47 UTC

Return to Bug #64765 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: gmcgraw@udel.edu

*** php-5.4.9/ext/snmp/snmp.c	Wed Nov 21 05:12:20 2012
--- php-5.4.9-r2/ext/snmp/snmp.c	Thu May  2 21:56:03 2013
***************
*** 1161,1167 ****
  			continue;
  		}
  		if ((*res)->sa_family == AF_INET6) {
! 			strcpy(session->peername, "udp6:");
  			pptr = session->peername + strlen(session->peername);
  			inet_ntop((*res)->sa_family, &(((struct sockaddr_in6*)(*res))->sin6_addr), pptr, MAX_NAME_LEN);
  		} else if ((*res)->sa_family == AF_INET) {
--- 1161,1167 ----
  			continue;
  		}
  		if ((*res)->sa_family == AF_INET6) {
! 			strcpy(session->peername, "udp6:[");
  			pptr = session->peername + strlen(session->peername);
  			inet_ntop((*res)->sa_family, &(((struct sockaddr_in6*)(*res))->sin6_addr), pptr, MAX_NAME_LEN);
  		} else if ((*res)->sa_family == AF_INET) {
***************
*** 1191,1197 ****
  	/* put back non-standard SNMP port */
  	if (session->remote_port != SNMP_PORT) {
  		pptr = session->peername + strlen(session->peername);
! 		sprintf(pptr, ":%d", session->remote_port);
  	}
  
  	php_network_freeaddresses(psal);
--- 1191,1201 ----
  	/* put back non-standard SNMP port */
  	if (session->remote_port != SNMP_PORT) {
  		pptr = session->peername + strlen(session->peername);
! 		sprintf(pptr, "]:%d", session->remote_port);
! 	} else if ((*res)->sa_family == AF_INET6) { 
! 		/* Properly end the ipv6 address, just like net-SNMP likes it */
! 		pptr = session->peername + strlen(session->peername);
! 		sprintf(pptr, "]");
  	}
  
  	php_network_freeaddresses(psal);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 02 00:01:29 2024 UTC