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-03 00:53 UTC

Return to Bug #64765 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: gmcgraw@udel.edu

*** php-5.4.1/ext/snmp/snmp.c	Tue Apr 24 16:47:33 2012
--- php-5.4.1-r2/ext/snmp/snmp.c	Thu May  2 22:51:56 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,1205 ----
  	/* put back non-standard SNMP port */
  	if (session->remote_port != SNMP_PORT) {
  		pptr = session->peername + strlen(session->peername);
! 		if ((*res)->sa_family == AF_INET6) { 
! 			sprintf(pptr, "]:%d", session->remote_port);
! 		} else {
! 			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: Wed Oct 16 07:01:27 2024 UTC