mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-31 22:40:48 +00:00
Bump bundled miniupnpc to 20161216
This commit is contained in:
parent
f43365e4ba
commit
56e5b34934
@ -1,12 +1,10 @@
|
|||||||
/* $Id: connecthostport.c,v 1.15 2015/10/09 16:26:19 nanard Exp $ */
|
/* $Id: connecthostport.c,v 1.16 2016/12/16 08:57:53 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2010-2015 Thomas Bernard
|
* Copyright (c) 2010-2016 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution. */
|
* LICENCE file provided in this distribution. */
|
||||||
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
|
|
||||||
/* use getaddrinfo() or gethostbyname()
|
/* use getaddrinfo() or gethostbyname()
|
||||||
* uncomment the following line in order to use gethostbyname() */
|
* uncomment the following line in order to use gethostbyname() */
|
||||||
#ifdef NO_GETADDRINFO
|
#ifdef NO_GETADDRINFO
|
||||||
@ -102,13 +100,13 @@ int connecthostport(const char * host, unsigned short port,
|
|||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt SO_RCVTIMEO");
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt SO_SNDTIMEO");
|
||||||
}
|
}
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
dest.sin_family = AF_INET;
|
dest.sin_family = AF_INET;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* $Id: minihttptestserver.c,v 1.19 2015/11/17 09:07:17 nanard Exp $ */
|
/* $Id: minihttptestserver.c,v 1.20 2016/12/16 08:54:55 nanard Exp $ */
|
||||||
/* Project : miniUPnP
|
/* Project : miniUPnP
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2011-2015 Thomas Bernard
|
* Copyright (c) 2011-2016 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution.
|
* LICENCE file provided in this distribution.
|
||||||
* */
|
* */
|
||||||
@ -611,7 +611,7 @@ int main(int argc, char * * argv) {
|
|||||||
if(pid < 0) {
|
if(pid < 0) {
|
||||||
perror("wait");
|
perror("wait");
|
||||||
} else {
|
} else {
|
||||||
printf("child(%d) terminated with status %d\n", pid, status);
|
printf("child(%d) terminated with status %d\n", (int)pid, status);
|
||||||
}
|
}
|
||||||
--child_to_wait_for;
|
--child_to_wait_for;
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ int main(int argc, char * * argv) {
|
|||||||
if(pid < 0) {
|
if(pid < 0) {
|
||||||
perror("wait");
|
perror("wait");
|
||||||
} else {
|
} else {
|
||||||
printf("child(%d) terminated with status %d\n", pid, status);
|
printf("child(%d) terminated with status %d\n", (int)pid, status);
|
||||||
}
|
}
|
||||||
--child_to_wait_for;
|
--child_to_wait_for;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
/* $Id: minisoap.c,v 1.24 2015/10/26 17:05:07 nanard Exp $ */
|
/* $Id: minisoap.c,v 1.24 2015/10/26 17:05:07 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
@ -20,6 +19,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
#include "minisoap.h"
|
#include "minisoap.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define OS_STRING "Win32"
|
#define OS_STRING "Win32"
|
||||||
#define MINIUPNPC_VERSION_STRING "2.0"
|
#define MINIUPNPC_VERSION_STRING "2.0"
|
||||||
@ -124,3 +124,5 @@ int soapPostSubmit(int fd,
|
|||||||
#endif
|
#endif
|
||||||
return httpWrite(fd, body, bodysize, headerbuf, headerssize);
|
return httpWrite(fd, body, bodysize, headerbuf, headerssize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
/* $Id: minissdpc.c,v 1.33 2016/12/16 08:57:20 nanard Exp $ */
|
||||||
|
|
||||||
/* $Id: minissdpc.c,v 1.31 2016/01/19 09:56:46 nanard Exp $ */
|
|
||||||
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
||||||
* Project : miniupnp
|
* Project : miniupnp
|
||||||
* Web : http://miniupnp.free.fr/
|
* Web : http://miniupnp.free.fr/
|
||||||
* Author : Thomas BERNARD
|
* Author : Thomas BERNARD
|
||||||
* copyright (c) 2005-2015 Thomas Bernard
|
* copyright (c) 2005-2016 Thomas Bernard
|
||||||
* This software is subjet to the conditions detailed in the
|
* This software is subjet to the conditions detailed in the
|
||||||
* provided LICENCE file. */
|
* provided LICENCE file. */
|
||||||
/*#include <syslog.h>*/
|
/*#include <syslog.h>*/
|
||||||
@ -13,6 +11,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#if defined (__NetBSD__)
|
||||||
|
#include <net/if.h>
|
||||||
|
#endif
|
||||||
#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
|
#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@ -72,6 +73,9 @@ struct sockaddr_un {
|
|||||||
|
|
||||||
#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
|
#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#if defined(__sun)
|
||||||
|
#include <sys/sockio.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
|
#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
|
||||||
@ -168,7 +172,7 @@ connectToMiniSSDPD(const char * socketpath)
|
|||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
|
|
||||||
@ -179,19 +183,20 @@ connectToMiniSSDPD(const char * socketpath)
|
|||||||
perror("socket(unix)");
|
perror("socket(unix)");
|
||||||
return MINISSDPC_SOCKET_ERROR;
|
return MINISSDPC_SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
|
||||||
/* setting a 3 seconds timeout */
|
/* setting a 3 seconds timeout */
|
||||||
|
/* not supported for AF_UNIX sockets under Solaris */
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
perror("setsockopt");
|
perror("setsockopt SO_RCVTIMEO unix");
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
perror("setsockopt");
|
perror("setsockopt SO_SNDTIMEO unix");
|
||||||
}
|
}
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
if(!socketpath)
|
if(!socketpath)
|
||||||
@ -627,7 +632,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
|
unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
|
||||||
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
|
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IPV6_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -642,7 +647,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAS_IP_MREQN
|
#ifdef HAS_IP_MREQN
|
||||||
@ -652,7 +657,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
reqn.imr_ifindex = if_nametoindex(multicastif);
|
reqn.imr_ifindex = if_nametoindex(multicastif);
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32)
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
@ -666,7 +671,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
mc_if.s_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
|
mc_if.s_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
|
|
||||||
/* $Id: miniupnpc.c,v 1.149 2016/02/09 09:50:46 nanard Exp $ */
|
/* $Id: miniupnpc.c,v 1.149 2016/02/09 09:50:46 nanard Exp $ */
|
||||||
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
||||||
* Project : miniupnp
|
* Project : miniupnp
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define UPNPDISCOVER_MEMORY_ERROR (-102)
|
#define UPNPDISCOVER_MEMORY_ERROR (-102)
|
||||||
|
|
||||||
/* versions : */
|
/* versions : */
|
||||||
#define MINIUPNPC_VERSION "2.0"
|
#define MINIUPNPC_VERSION "2.0.20161216"
|
||||||
#define MINIUPNPC_API_VERSION 16
|
#define MINIUPNPC_API_VERSION 16
|
||||||
|
|
||||||
/* Source port:
|
/* Source port:
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
/* $Id: miniwget.c,v 1.76 2016/12/16 08:54:04 nanard Exp $ */
|
||||||
|
|
||||||
/* $Id: miniwget.c,v 1.75 2016/01/24 17:24:36 nanard Exp $ */
|
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Website : http://miniupnp.free.fr/
|
* Website : http://miniupnp.free.fr/
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
@ -50,6 +48,7 @@
|
|||||||
#define MIN(x,y) (((x)<(y))?(x):(y))
|
#define MIN(x,y) (((x)<(y))?(x):(y))
|
||||||
#endif /* MIN */
|
#endif /* MIN */
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define OS_STRING "Win32"
|
#define OS_STRING "Win32"
|
||||||
#define MINIUPNPC_VERSION_STRING "2.0"
|
#define MINIUPNPC_VERSION_STRING "2.0"
|
||||||
@ -89,8 +88,10 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
unsigned int content_buf_used = 0;
|
unsigned int content_buf_used = 0;
|
||||||
char chunksize_buf[32];
|
char chunksize_buf[32];
|
||||||
unsigned int chunksize_buf_index;
|
unsigned int chunksize_buf_index;
|
||||||
|
#ifdef DEBUG
|
||||||
char * reason_phrase = NULL;
|
char * reason_phrase = NULL;
|
||||||
int reason_phrase_len = 0;
|
int reason_phrase_len = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(status_code) *status_code = -1;
|
if(status_code) *status_code = -1;
|
||||||
header_buf = malloc(header_buf_len);
|
header_buf = malloc(header_buf_len);
|
||||||
@ -187,8 +188,10 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
*status_code = atoi(header_buf + sp + 1);
|
*status_code = atoi(header_buf + sp + 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
reason_phrase = header_buf + sp + 1;
|
reason_phrase = header_buf + sp + 1;
|
||||||
reason_phrase_len = i - sp - 1;
|
reason_phrase_len = i - sp - 1;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
/* $Id: minixml.c,v 1.11 2014/02/03 15:54:12 nanard Exp $ */
|
/* $Id: minixml.c,v 1.11 2014/02/03 15:54:12 nanard Exp $ */
|
||||||
/* minixml.c : the minimum size a xml parser can be ! */
|
/* minixml.c : the minimum size a xml parser can be ! */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
/* $Id: minixmlvalid.c,v 1.7 2015/07/15 12:41:15 nanard Exp $ */
|
/* $Id: minixmlvalid.c,v 1.7 2015/07/15 12:41:15 nanard Exp $ */
|
||||||
/* MiniUPnP Project
|
/* MiniUPnP Project
|
||||||
* http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
* http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* $Id: portlistingparse.c,v 1.9 2015/07/15 12:41:13 nanard Exp $ */
|
/* $Id: portlistingparse.c,v 1.10 2016/12/16 08:53:21 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
* (c) 2011-2015 Thomas Bernard
|
* (c) 2011-2016 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed
|
* This software is subject to the conditions detailed
|
||||||
* in the LICENCE file provided within the distribution */
|
* in the LICENCE file provided within the distribution */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -55,7 +55,7 @@ startelt(void * d, const char * name, int l)
|
|||||||
pdata->curelt = PortMappingEltNone;
|
pdata->curelt = PortMappingEltNone;
|
||||||
for(i = 0; elements[i].str; i++)
|
for(i = 0; elements[i].str; i++)
|
||||||
{
|
{
|
||||||
if(memcmp(name, elements[i].str, l) == 0)
|
if(strlen(elements[i].str) == (size_t)l && memcmp(name, elements[i].str, l) == 0)
|
||||||
{
|
{
|
||||||
pdata->curelt = elements[i].code;
|
pdata->curelt = elements[i].code;
|
||||||
break;
|
break;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: upnpc.c,v 1.114 2016/01/22 15:04:23 nanard Exp $ */
|
/* $Id: upnpc.c,v 1.115 2016/10/07 09:04:01 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2005-2016 Thomas Bernard
|
* Copyright (c) 2005-2016 Thomas Bernard
|
||||||
@ -242,7 +242,7 @@ static void NewListRedirections(struct UPNPUrls * urls,
|
|||||||
* 2 - get extenal ip address
|
* 2 - get extenal ip address
|
||||||
* 3 - Add port mapping
|
* 3 - Add port mapping
|
||||||
* 4 - get this port mapping from the IGD */
|
* 4 - get this port mapping from the IGD */
|
||||||
static void SetRedirectAndTest(struct UPNPUrls * urls,
|
static int SetRedirectAndTest(struct UPNPUrls * urls,
|
||||||
struct IGDdatas * data,
|
struct IGDdatas * data,
|
||||||
const char * iaddr,
|
const char * iaddr,
|
||||||
const char * iport,
|
const char * iport,
|
||||||
@ -262,13 +262,13 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||||||
if(!iaddr || !iport || !eport || !proto)
|
if(!iaddr || !iport || !eport || !proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Wrong arguments\n");
|
fprintf(stderr, "Wrong arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
proto = protofix(proto);
|
proto = protofix(proto);
|
||||||
if(!proto)
|
if(!proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "invalid protocol\n");
|
fprintf(stderr, "invalid protocol\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = UPNP_GetExternalIPAddress(urls->controlURL,
|
r = UPNP_GetExternalIPAddress(urls->controlURL,
|
||||||
@ -302,17 +302,19 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||||||
eport, proto, NULL/*remoteHost*/,
|
eport, proto, NULL/*remoteHost*/,
|
||||||
intClient, intPort, NULL/*desc*/,
|
intClient, intPort, NULL/*desc*/,
|
||||||
NULL/*enabled*/, duration);
|
NULL/*enabled*/, duration);
|
||||||
if(r!=UPNPCOMMAND_SUCCESS)
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
|
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
|
||||||
r, strupnperror(r));
|
r, strupnperror(r));
|
||||||
else {
|
return -2;
|
||||||
|
} else {
|
||||||
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
|
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
|
||||||
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
|
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
|
||||||
externalIPAddress, eport, proto, intClient, intPort, duration);
|
externalIPAddress, eport, proto, intClient, intPort, duration);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
RemoveRedirect(struct UPNPUrls * urls,
|
RemoveRedirect(struct UPNPUrls * urls,
|
||||||
struct IGDdatas * data,
|
struct IGDdatas * data,
|
||||||
const char * eport,
|
const char * eport,
|
||||||
@ -323,19 +325,25 @@ RemoveRedirect(struct UPNPUrls * urls,
|
|||||||
if(!proto || !eport)
|
if(!proto || !eport)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "invalid arguments\n");
|
fprintf(stderr, "invalid arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
proto = protofix(proto);
|
proto = protofix(proto);
|
||||||
if(!proto)
|
if(!proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "protocol invalid\n");
|
fprintf(stderr, "protocol invalid\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
r = UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, remoteHost);
|
r = UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, remoteHost);
|
||||||
printf("UPNP_DeletePortMapping() returned : %d\n", r);
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
|
printf("UPNP_DeletePortMapping() failed with code : %d\n", r);
|
||||||
|
return -2;
|
||||||
|
}else {
|
||||||
|
printf("UPNP_DeletePortMapping() returned : %d\n", r);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
RemoveRedirectRange(struct UPNPUrls * urls,
|
RemoveRedirectRange(struct UPNPUrls * urls,
|
||||||
struct IGDdatas * data,
|
struct IGDdatas * data,
|
||||||
const char * ePortStart, char const * ePortEnd,
|
const char * ePortStart, char const * ePortEnd,
|
||||||
@ -349,16 +357,22 @@ RemoveRedirectRange(struct UPNPUrls * urls,
|
|||||||
if(!proto || !ePortStart || !ePortEnd)
|
if(!proto || !ePortStart || !ePortEnd)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "invalid arguments\n");
|
fprintf(stderr, "invalid arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
proto = protofix(proto);
|
proto = protofix(proto);
|
||||||
if(!proto)
|
if(!proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "protocol invalid\n");
|
fprintf(stderr, "protocol invalid\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
r = UPNP_DeletePortMappingRange(urls->controlURL, data->first.servicetype, ePortStart, ePortEnd, proto, manage);
|
r = UPNP_DeletePortMappingRange(urls->controlURL, data->first.servicetype, ePortStart, ePortEnd, proto, manage);
|
||||||
printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
|
printf("UPNP_DeletePortMappingRange() failed with code : %d\n", r);
|
||||||
|
return -2;
|
||||||
|
}else {
|
||||||
|
printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
||||||
@ -711,29 +725,33 @@ int main(int argc, char ** argv)
|
|||||||
NewListRedirections(&urls, &data);
|
NewListRedirections(&urls, &data);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
commandargv[0], commandargv[1],
|
commandargv[0], commandargv[1],
|
||||||
commandargv[2], commandargv[3],
|
commandargv[2], commandargv[3],
|
||||||
(commandargc > 4)?commandargv[4]:"0",
|
(commandargc > 4)?commandargv[4]:"0",
|
||||||
description, 0);
|
description, 0) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
|
if (RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
|
||||||
commandargc > 2 ? commandargv[2] : NULL);
|
commandargc > 2 ? commandargv[2] : NULL) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 'n': /* aNy */
|
case 'n': /* aNy */
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
commandargv[0], commandargv[1],
|
commandargv[0], commandargv[1],
|
||||||
commandargv[2], commandargv[3],
|
commandargv[2], commandargv[3],
|
||||||
(commandargc > 4)?commandargv[4]:"0",
|
(commandargc > 4)?commandargv[4]:"0",
|
||||||
description, 1);
|
description, 1) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
if (commandargc < 3)
|
if (commandargc < 3)
|
||||||
fprintf(stderr, "too few arguments\n");
|
fprintf(stderr, "too few arguments\n");
|
||||||
|
|
||||||
RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
|
if (RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
|
||||||
commandargc > 3 ? commandargv[3] : NULL);
|
commandargc > 3 ? commandargv[3] : NULL) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
GetConnectionStatus(&urls, &data);
|
GetConnectionStatus(&urls, &data);
|
||||||
@ -749,17 +767,19 @@ int main(int argc, char ** argv)
|
|||||||
break;
|
break;
|
||||||
} else if(is_int(commandargv[i+1])){
|
} else if(is_int(commandargv[i+1])){
|
||||||
/* 2nd parameter is an integer : <port> <external_port> <protocol> */
|
/* 2nd parameter is an integer : <port> <external_port> <protocol> */
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
lanaddr, commandargv[i],
|
lanaddr, commandargv[i],
|
||||||
commandargv[i+1], commandargv[i+2], "0",
|
commandargv[i+1], commandargv[i+2], "0",
|
||||||
description, 0);
|
description, 0) < 0)
|
||||||
|
retcode = 2;
|
||||||
i+=3; /* 3 parameters parsed */
|
i+=3; /* 3 parameters parsed */
|
||||||
} else {
|
} else {
|
||||||
/* 2nd parameter not an integer : <port> <protocol> */
|
/* 2nd parameter not an integer : <port> <protocol> */
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
lanaddr, commandargv[i],
|
lanaddr, commandargv[i],
|
||||||
commandargv[i], commandargv[i+1], "0",
|
commandargv[i], commandargv[i+1], "0",
|
||||||
description, 0);
|
description, 0) < 0)
|
||||||
|
retcode = 2;
|
||||||
i+=2; /* 2 parameters parsed */
|
i+=2; /* 2 parameters parsed */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
|
|
||||||
/* $Id: upnpcommands.c,v 1.47 2016/03/07 12:26:48 nanard Exp $ */
|
/* $Id: upnpcommands.c,v 1.47 2016/03/07 12:26:48 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
/* $Id: upnpreplyparse.c,v 1.19 2015/07/15 10:29:11 nanard Exp $ */
|
/* $Id: upnpreplyparse.c,v 1.19 2015/07/15 10:29:11 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
@ -32,7 +32,7 @@ Requires: systemd
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Provides: bundled(http-parser) = 2.7.0
|
Provides: bundled(http-parser) = 2.7.0
|
||||||
Provides: bundled(miniupnpc) = 2.0
|
Provides: bundled(miniupnpc) = 2.0.20161216
|
||||||
|
|
||||||
%if 0%{?rhel} >= 6
|
%if 0%{?rhel} >= 6
|
||||||
Provides: bundled(libnatpmp) = 20131126
|
Provides: bundled(libnatpmp) = 20131126
|
||||||
|
Loading…
x
Reference in New Issue
Block a user