miniupnpd: Updated to 2.0.20180422

arm-ng
AndreDVJ 8 years ago committed by kille72
parent 2fd99b3088
commit 16a597da59

@ -1,5 +1,7 @@
$Id: Changelog.txt,v 1.438 2018/04/06 09:17:45 nanard Exp $
$Id: Changelog.txt,v 1.439 2018/04/12 09:32:22 nanard Exp $
2018/04/12:
pf: set dst address in rule if use_ext_ip_addr is set
2018/04/06:
Add options for netfilter scripts

@ -1,4 +1,4 @@
/* $Id: daemonize.c,v 1.13 2012/03/05 20:36:15 nanard Exp $ */
/* $Id: daemonize.c,v 1.14 2018/04/22 19:36:58 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006 Thomas Bernard
@ -67,7 +67,7 @@ writepidfile(const char * fname, int pid)
int pidstringlen;
int pidfile;
if(!fname || (strlen(fname) == 0))
if(!fname || fname[0] == '\0')
return -1;
if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0)
@ -102,7 +102,7 @@ checkforrunning(const char * fname)
int pidfile;
pid_t pid;
if(!fname || (strlen(fname) == 0))
if(!fname || fname[0] == '\0')
return -1;
if( (pidfile = open(fname, O_RDONLY)) < 0)

@ -1,4 +1,4 @@
/* $Id: minissdp.c,v 1.92 2018/03/13 10:52:39 nanard Exp $ */
/* $Id: minissdp.c,v 1.93 2018/04/22 19:36:58 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
@ -237,7 +237,7 @@ OpenAndConfSSDPReceiveSocket(int ipv6)
#if defined(SO_BINDTODEVICE) && !defined(MULTIPLE_EXTERNAL_IP)
/* One and only one LAN interface */
if(lan_addrs.lh_first != NULL && lan_addrs.lh_first->list.le_next == NULL
&& strlen(lan_addrs.lh_first->ifname) > 0)
&& lan_addrs.lh_first->ifname[0] != '\0')
{
if(setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE,
lan_addrs.lh_first->ifname,
@ -1002,7 +1002,7 @@ ProcessSSDPData(int s, const char *bufr, int n,
{
if(lan_addr != NULL)
{
if(lan_addr->index != (unsigned)source_if)
if(lan_addr->index != (unsigned)source_if && lan_addr->index != 0)
{
syslog(LOG_WARNING, "interface index not matching %u != %d", lan_addr->index, source_if);
}

@ -1,4 +1,4 @@
/* $Id: miniupnpd.c,v 1.227 2018/04/12 08:12:31 nanard Exp $ */
/* $Id: miniupnpd.c,v 1.228 2018/04/22 19:36:09 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
@ -996,6 +996,11 @@ parselanaddr(struct lan_addr_s * lan_addr, const char * str)
str);
return -1;
}
#else
else
{
syslog(LOG_NOTICE, "it is advised to use network interface name instead of %s", str);
}
#endif
return 0;
parselan_error:

@ -1,4 +1,4 @@
/* $Id: iptpinhole.c,v 1.18 2018/03/13 23:05:21 nanard Exp $ */
/* $Id: iptpinhole.c,v 1.19 2018/04/22 19:36:58 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2012-2018 Thomas Bernard
@ -16,6 +16,7 @@
#include "../macros.h"
#include "iptpinhole.h"
#include "../upnpglobalvars.h"
#include "../upnputils.h"
#ifdef ENABLE_UPNPPINHOLE

@ -1,8 +1,8 @@
/* $Id: options.c,v 1.34 2018/02/22 13:18:58 nanard Exp $ */
/* $Id: options.c,v 1.35 2018/04/22 19:36:58 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* author: Ryan Wagoner
* (c) 2006-2014 Thomas Bernard
* (c) 2006-2018 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -106,7 +106,7 @@ readoptionsfile(const char * fname)
size_t len;
void *tmp;
if(!fname || (strlen(fname) == 0))
if(!fname || (fname[0] == '\0'))
return -1;
memset(buffer, 0, sizeof(buffer));

@ -1,8 +1,8 @@
/* $Id: obsdrdr.c,v 1.87 2016/02/16 12:14:28 nanard Exp $ */
/* $Id: obsdrdr.c,v 1.89 2018/04/22 19:30:49 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2016 Thomas Bernard
* (c) 2006-2018 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -336,6 +336,11 @@ add_redirect_rule2(const char * ifname,
inet_pton(AF_INET, rhost, &pcr.rule.src.addr.v.a.addr.v4.s_addr);
pcr.rule.src.addr.v.a.mask.v4.s_addr = htonl(INADDR_NONE);
}
if(use_ext_ip_addr && use_ext_ip_addr[0] != '\0')
{
inet_pton(AF_INET, use_ext_ip_addr, &pcr.rule.dst.addr.v.a.addr.v4.s_addr);
pcr.rule.dst.addr.v.a.mask.v4.s_addr = htonl(INADDR_NONE);
}
#ifndef PF_NEWSTYLE
pcr.rule.rpool.proxy_port[0] = iport;
pcr.rule.rpool.proxy_port[1] = iport;
@ -1081,6 +1086,7 @@ void
list_rules(void)
{
char buf[32];
char buf2[32];
int i, n;
struct pfioc_rule pr;
#ifndef PF_NEWSTYLE
@ -1105,11 +1111,12 @@ list_rules(void)
pr.nr = i;
if(ioctl(dev, DIOCGETRULE, &pr) < 0)
perror("DIOCGETRULE");
printf(" %s %s %d:%d -> %d:%d proto %d keep_state=%d action=%d\n",
printf(" %s %s %d:%d -> %s %d:%d proto %d keep_state=%d action=%d\n",
pr.rule.ifname,
inet_ntop(AF_INET, &pr.rule.src.addr.v.a.addr.v4.s_addr, buf, 32),
(int)ntohs(pr.rule.dst.port[0]),
(int)ntohs(pr.rule.dst.port[1]),
inet_ntop(AF_INET, &pr.rule.dst.addr.v.a.addr.v4.s_addr, buf2, 32),
#ifndef PF_NEWSTYLE
(int)pr.rule.rpool.proxy_port[0],
(int)pr.rule.rpool.proxy_port[1],

@ -1,7 +1,7 @@
/* $Id: testobsdrdr.c,v 1.29 2017/11/02 15:44:16 nanard Exp $ */
/* $Id: testobsdrdr.c,v 1.30 2018/04/12 09:27:54 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2017 Thomas Bernard
* (c) 2006-2018 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -19,6 +19,7 @@ int runtime_flags = 0;
const char * tag = 0;
const char * anchor_name = "miniupnpd";
const char * queue = NULL;
const char * use_ext_ip_addr = "42.42.42.42";
void
list_rules(void);
@ -99,6 +100,7 @@ main(int argc, char * * argv)
if(add_redirect_rule2("ep0", "8.8.8.8", 12123, "192.168.1.125", 1234,
IPPROTO_UDP, "test description", 0) < 0)
printf("add_redirect_rule2() #3 failed\n");
use_ext_ip_addr = NULL;
if(add_redirect_rule2("em0", NULL, 12123, "127.1.2.3", 1234,
IPPROTO_TCP, "test description tcp", 0) < 0)
printf("add_redirect_rule2() #4 failed\n");

Loading…
Cancel
Save