miniupnpd/pcpserver.c: fix for IPv6

This commit is contained in:
Thomas Bernard 2014-03-24 12:15:50 +01:00
parent ad88cc0819
commit d233655630
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: pcpserver.c,v 1.24 2014/03/24 11:03:52 nanard Exp $ */ /* $Id: pcpserver.c,v 1.25 2014/03/24 11:13:04 nanard Exp $ */
/* MiniUPnP project /* MiniUPnP project
* Website : http://miniupnp.free.fr/ * Website : http://miniupnp.free.fr/
* Author : Peter Tatrai * Author : Peter Tatrai
@ -1424,8 +1424,10 @@ int ProcessIncomingPCPPacket(int s, unsigned char *buff, int len,
len = PCP_MIN_LEN; len = PCP_MIN_LEN;
else else
len = (len + 3) & ~3; /* round up resp. length to multiple of 4 */ len = (len + 3) & ~3; /* round up resp. length to multiple of 4 */
len = sendto_or_schedule(s, buff, len, 0, len = sendto_or_schedule(s, buff, len, 0, senderaddr,
(struct sockaddr *)senderaddr, sizeof(struct sockaddr_in)); (senderaddr->sa_family == AF_INET) ?
sizeof(struct sockaddr_in) :
sizeof(struct sockaddr_in6) );
if( len < 0 ) { if( len < 0 ) {
syslog(LOG_ERR, "sendto(pcpserver): %m"); syslog(LOG_ERR, "sendto(pcpserver): %m");
} }