From d23365563011567510ecc27d05d89b2181e2fa82 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Mon, 24 Mar 2014 12:15:50 +0100 Subject: [PATCH] miniupnpd/pcpserver.c: fix for IPv6 --- miniupnpd/pcpserver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/miniupnpd/pcpserver.c b/miniupnpd/pcpserver.c index b5074dc..dd15908 100644 --- a/miniupnpd/pcpserver.c +++ b/miniupnpd/pcpserver.c @@ -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 * Website : http://miniupnp.free.fr/ * Author : Peter Tatrai @@ -1424,8 +1424,10 @@ int ProcessIncomingPCPPacket(int s, unsigned char *buff, int len, len = PCP_MIN_LEN; else len = (len + 3) & ~3; /* round up resp. length to multiple of 4 */ - len = sendto_or_schedule(s, buff, len, 0, - (struct sockaddr *)senderaddr, sizeof(struct sockaddr_in)); + len = sendto_or_schedule(s, buff, len, 0, senderaddr, + (senderaddr->sa_family == AF_INET) ? + sizeof(struct sockaddr_in) : + sizeof(struct sockaddr_in6) ); if( len < 0 ) { syslog(LOG_ERR, "sendto(pcpserver): %m"); }