/user/miniupnpd/999-n56u.patch
Patch | 671 lines | 632 code | 39 blank | 0 comment | 0 complexity | 508a02c42ee9172acf0097cf7df84f04 MD5 | raw file
Possible License(s): CC-BY-SA-3.0, BSD-3-Clause, MPL-2.0-no-copyleft-exception, GPL-2.0, GPL-3.0, LGPL-3.0, 0BSD, AGPL-1.0, LGPL-2.1, LGPL-2.0
- diff -ur miniupnpd-1.7.20120824/genconfig.sh miniupnpd-1.7.20120824.b/genconfig.sh
- --- miniupnpd-1.7.20120824/genconfig.sh 2012-07-11 06:24:52.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/genconfig.sh 2012-09-04 18:46:50.417238227 +0800
- @@ -68,12 +68,15 @@
- OS_VERSION="Tomato $(cat ../shared/tomato_version)"
- fi
-
- +OS_NAME=Wive-NG-RTNL
- +
- ${RM} ${CONFIGFILE}
-
- echo "/* MiniUPnP Project" >> ${CONFIGFILE}
- echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}
- echo " * (c) 2006-2012 Thomas Bernard" >> ${CONFIGFILE}
- -echo " * generated by $0 on `date`" >> ${CONFIGFILE}
- +echo " * generated by $0 on `LC_ALL=C date -u`" >> ${CONFIGFILE}
- echo " * using command line options $* */" >> ${CONFIGFILE}
- echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}
- echo "#define $CONFIGMACRO" >> ${CONFIGFILE}
- @@ -259,6 +262,13 @@
- echo "#endif" >> ${CONFIGFILE}
- FW=netfilter
- ;;
- + RT-N56U)
- + OS_VERSION=1.1.2.3
- + OS_URL=http://code.google.com/p/rt-n56u/
- + echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
- + FW=netfilter
- + LEASEFILE=1
- + ;;
- Darwin)
- echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
- FW=ipfw
- @@ -326,9 +336,9 @@
-
- echo "/* Uncomment the following line to enable caching of results of" >> ${CONFIGFILE}
- echo " * the getifstats() function */" >> ${CONFIGFILE}
- -echo "/*#define ENABLE_GETIFSTATS_CACHING*/" >> ${CONFIGFILE}
- +echo "#define ENABLE_GETIFSTATS_CACHING" >> ${CONFIGFILE}
- echo "/* The cache duration is indicated in seconds */" >> ${CONFIGFILE}
- -echo "#define GETIFSTATS_CACHING_DURATION 2" >> ${CONFIGFILE}
- +echo "#define GETIFSTATS_CACHING_DURATION 3" >> ${CONFIGFILE}
- echo "" >> ${CONFIGFILE}
-
- echo "/* Uncomment the following line to enable multiple external ip support */" >> ${CONFIGFILE}
- @@ -394,7 +404,7 @@
- echo "" >> ${CONFIGFILE}
-
- echo "/* include interface name in pf and ipf rules */" >> ${CONFIGFILE}
- -echo "#define USE_IFNAME_IN_RULES" >> ${CONFIGFILE}
- +echo "/*#define USE_IFNAME_IN_RULES*/" >> ${CONFIGFILE}
- echo "" >> ${CONFIGFILE}
-
- echo "/* Experimental NFQUEUE support. */" >> ${CONFIGFILE}
- diff -ur miniupnpd-1.7.20120824/getifaddr.c miniupnpd-1.7.20120824.b/getifaddr.c
- --- miniupnpd-1.7.20120824/getifaddr.c 2012-03-06 04:37:13.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/getifaddr.c 2012-09-04 19:51:03.410365520 +0800
- @@ -36,30 +36,39 @@
- int ifrlen;
- struct sockaddr_in * addr;
- ifrlen = sizeof(ifr);
- + int ret = -1;
-
- if(!ifname || ifname[0]=='\0')
- return -1;
- s = socket(PF_INET, SOCK_DGRAM, 0);
- if(s < 0)
- {
- - syslog(LOG_ERR, "socket(PF_INET, SOCK_DGRAM): %m");
- + syslog(LOG_DEBUG, "socket(PF_INET, SOCK_DGRAM): %m");
- return -1;
- }
- strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
- + if(ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
- + {
- + syslog(LOG_DEBUG, "ioctl(s, SIOCGIFFLAGS, ...): %m");
- + goto err;
- + } else
- + if ((ifr.ifr_flags & IFF_UP) == 0)
- + goto err;
- if(ioctl(s, SIOCGIFADDR, &ifr, &ifrlen) < 0)
- {
- - syslog(LOG_ERR, "ioctl(s, SIOCGIFADDR, ...): %m");
- - close(s);
- - return -1;
- + syslog(LOG_DEBUG, "ioctl(s, SIOCGIFADDR, ...): %m");
- + goto err;
- }
- addr = (struct sockaddr_in *)&ifr.ifr_addr;
- if(!inet_ntop(AF_INET, &addr->sin_addr, buf, len))
- {
- - syslog(LOG_ERR, "inet_ntop(): %m");
- - close(s);
- - return -1;
- + syslog(LOG_DEBUG, "inet_ntop(): %m");
- + goto err;
- }
- close(s);
- + ret = 0;
- + err:
- + return ret;
- #else /* ifndef USE_GETIFADDRS */
- /* Works for all address families (both ip v4 and ip v6) */
- struct ifaddrs * ifap;
- @@ -69,7 +78,7 @@
- return -1;
- if(getifaddrs(&ifap)<0)
- {
- - syslog(LOG_ERR, "getifaddrs: %m");
- + syslog(LOG_DEBUG, "getifaddrs: %m");
- return -1;
- }
- for(ife = ifap; ife; ife = ife->ifa_next)
- @@ -95,8 +104,9 @@
- }
- }
- freeifaddrs(ifap);
- -#endif
- +
- return 0;
- +#endif
- }
-
- #ifdef ENABLE_IPV6
- @@ -115,7 +125,7 @@
-
- if(getifaddrs(&ifap)<0)
- {
- - syslog(LOG_ERR, "getifaddrs: %m");
- + syslog(LOG_DEBUG, "getifaddrs: %m");
- return -1;
- }
- for(ife = ifap; ife; ife = ife->ifa_next)
- diff -ur miniupnpd-1.7.20120824/linux/getifstats.c miniupnpd-1.7.20120824.b/linux/getifstats.c
- --- miniupnpd-1.7.20120824/linux/getifstats.c 2012-04-07 01:47:58.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/linux/getifstats.c 2012-09-07 04:14:11.335411659 +0800
- @@ -22,7 +22,9 @@
- char * p;
- int i;
- int r = -1;
- +#if 0
- char fname[64];
- +#endif
- #ifdef ENABLE_GETIFSTATS_CACHING
- static time_t cache_timestamp = 0;
- static struct ifdata cache_data;
- @@ -86,7 +88,9 @@
- break;
- }
- fclose(f);
- +#if 0 /* Disable get speed. In 2.6.21 kernel not supported this. */
- /* get interface speed */
- + /* NB! some interfaces, like ppp, don't support speed queries */
- snprintf(fname, sizeof(fname), "/sys/class/net/%s/speed", ifname);
- f = fopen(fname, "r");
- if(f) {
- @@ -96,9 +100,8 @@
- data->baudrate = 1000000*i;
- }
- fclose(f);
- - } else {
- - syslog(LOG_WARNING, "cannot read %s file : %m", fname);
- }
- +#endif
- #ifdef ENABLE_GETIFSTATS_CACHING
- if(r==0 && current_time!=((time_t)-1)) {
- /* cache the new data */
- diff -ur miniupnpd-1.7.20120824/Makefile.linux miniupnpd-1.7.20120824.b/Makefile.linux
- --- miniupnpd-1.7.20120824/Makefile.linux 2012-08-25 02:14:23.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/Makefile.linux 2012-09-13 06:39:48.875968999 +0800
- @@ -23,7 +23,6 @@
- #CFLAGS = -O -g -DDEBUG
- CFLAGS ?= -Os
- CFLAGS += -fno-strict-aliasing
- -CFLAGS += -fno-common
- CFLAGS += -D_GNU_SOURCE
- CFLAGS += -Wall
- CFLAGS += -Wextra -Wstrict-prototypes -Wdeclaration-after-statement
- @@ -35,6 +34,22 @@
- STRIP ?= strip
- CP = cp
-
- +CFLAGS += -ffunction-sections -fdata-sections
- +LDFLAGS += -Wl,--gc-sections
- +
- +ifeq ($(KERNEL3X),y)
- +LIBS = -lip4tc
- +CFLAGS := $(CFLAGS) -DIPTABLES_143
- +LDFLAGS := $(LDFLAGS) -lip4tc
- +else
- +IPTABLESPATH=../../iptables-1.3.x
- +LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
- +CFLAGS := $(CFLAGS) -I$(IPTABLESPATH)/include/
- +LDFLAGS := $(LDFLAGS) -L$(IPTABLESPATH)/libiptc/
- +endif
-
- INSTALLPREFIX ?= $(PREFIX)/usr
- SBININSTALLDIR = $(INSTALLPREFIX)/sbin
- @@ -48,80 +63,15 @@
- upnpevents.o upnputils.o getconnstatus.o \
- upnppinhole.o
-
- -LNXOBJS = linux/getifstats.o linux/ifacewatcher.o linux/getroute.o
- +LNXOBJS = linux/getifstats.o linux/ifacewatcher.o
- NETFILTEROBJS = netfilter/iptcrdr.o netfilter/iptpinhole.o
-
- ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS)
-
- -ifeq "$(wildcard /etc/gentoo-release )" ""
- -LIBS ?= -liptc
- -else # gentoo
- -# the following is better, at least on gentoo with iptables 1.4.6
- -# see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1618
- -# and http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=2183
- -LIBS ?= -lip4tc
- -CFLAGS := -DIPTABLES_143 $(CFLAGS)
- -endif
- -
- -ARCH ?= $(shell uname -m | grep -q "x86_64" && echo 64)
- -ifdef IPTABLESPATH
- -CFLAGS := $(CFLAGS) -I$(IPTABLESPATH)/include/
- -LDFLAGS := $(LDFLAFGS) -L$(IPTABLESPATH)/libiptc/
- -# get iptables version and set IPTABLES_143 macro if needed
- -ifeq ($(TARGET_OPENWRT),)
- -IPTABLESVERSION := $(shell grep "\#define VERSION" $(IPTABLESPATH)/config.h | tr -d \" |cut -d" " -f3 )
- -IPTABLESVERSION1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
- -IPTABLESVERSION2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
- -IPTABLESVERSION3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
- -# test if iptables version >= 1.4.3
- -TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -ge 4 \) \) -a \( $(IPTABLESVERSION3) -ge 3 \) ] && echo 1 )
- -ifeq ($(TEST), 1)
- -CFLAGS := $(CFLAGS) -DIPTABLES_143
- -# the following sucks, but works
- -LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o
- -#LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
- -else # ifeq ($(TEST), 1)
- -LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
- -endif # ifeq ($(TEST), 1)
- -else # ($(TARGET_OPENWRT),)
- -# openWRT :
- -# check for system-wide iptables files. Test if iptables version >= 1.4.3
- -# the following test has to be verified :
- -TEST := $(shell test -f /usr/include/iptables/internal.h && grep -q "\#define IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1)
- -ifeq ($(TEST), 1)
- -CFLAGS := $(CFLAGS) -DIPTABLES_143
- -LIBS = -liptc
- -endif # ($(TEST), 1)
- -TEST_LIB := $(shell test -f /usr/lib$(ARCH)/libiptc.a && echo 1)
- -ifeq ($(TEST_LIB), 1)
- -LIBS = -liptc /usr/lib$(ARCH)/libiptc.a
- -endif # ($(TEST_LIB), 1)
- -endif # ($(TARGET_OPENWRT),)
- -else # ifdef IPTABLESPATH
- -# IPTABLESPATH not defined
- -# the following test has to be verified :
- -TEST := $(shell test -f /usr/include/xtables.h && grep -q "XTABLES_VERSION_CODE" /usr/include/xtables.h && echo 1)
- -ifeq ($(TEST), 1)
- -CFLAGS := $(CFLAGS) -DIPTABLES_143
- -LIBS = -liptc
- -TESTIP4TC := $(shell test -f /lib/libip4tc.so && echo 1)
- -ifeq ($(TESTIP4TC), 1)
- -LIBS := $(LIBS) -lip4tc
- -endif # ($(TESTIP4TC), 1)
- -TESTIP6TC := $(shell test -f /lib/libip6tc.so && echo 1)
- -ifeq ($(TESTIP6TC), 1)
- -LIBS := $(LIBS) -lip6tc
- -endif # ($(TESTIP6TC), 1)
- -endif # ($(TEST), 1)
- -endif # ifdef IPTABLESPATH
- -
- -LIBS += -lnfnetlink
- -
- TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
-
- EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
- - testupnppermissions miniupnpdctl testgetifaddr \
- - testgetroute
- + testupnppermissions miniupnpdctl testgetifaddr
-
- .PHONY: all clean install depend genuuid
-
- @@ -162,7 +112,7 @@
- sed -i -e "s/^uuid=[-0-9a-f]*/uuid=`($(STAGING_DIR_HOST)/bin/genuuid||$(STAGING_DIR_HOST)/bin/uuidgen||$(STAGING_DIR_HOST)/bin/uuid) 2>/dev/null`/" miniupnpd.conf
- endif
-
- -miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS)
- +miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS)
-
- testupnpdescgen: $(TESTUPNPDESCGENOBJS)
-
- @@ -172,8 +122,6 @@
-
- testgetifaddr: testgetifaddr.o getifaddr.o
-
- -testgetroute: testgetroute.o linux/getroute.o upnputils.o -lnfnetlink
- -
- miniupnpdctl: miniupnpdctl.o
-
- config.h: genconfig.sh VERSION
- diff -ur miniupnpd-1.7.20120824/minissdp.c miniupnpd-1.7.20120824.b/minissdp.c
- --- miniupnpd-1.7.20120824/minissdp.c 2012-08-22 01:11:41.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/minissdp.c 2012-09-04 18:42:17.221295126 +0800
- @@ -106,6 +106,7 @@
- }
-
- memset(&sockname, 0, sizeof(struct sockaddr_storage));
- +#ifdef ENABLE_IPV6
- if(ipv6) {
- struct sockaddr_in6 * saddr = (struct sockaddr_in6 *)&sockname;
- saddr->sin6_family = AF_INET6;
- @@ -113,6 +114,7 @@
- saddr->sin6_addr = in6addr_any;
- sockname_len = sizeof(struct sockaddr_in6);
- } else {
- +#endif
- struct sockaddr_in * saddr = (struct sockaddr_in *)&sockname;
- saddr->sin_family = AF_INET;
- saddr->sin_port = htons(SSDP_PORT);
- @@ -121,7 +123,9 @@
- saddr->sin_addr.s_addr = htonl(INADDR_ANY);
- /*saddr->sin_addr.s_addr = inet_addr(ifaddr);*/
- sockname_len = sizeof(struct sockaddr_in);
- +#ifdef ENABLE_IPV6
- }
- +#endif
-
- if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &j, sizeof(j)) < 0)
- {
- @@ -582,7 +586,8 @@
- }
- if (lan_addr == NULL)
- {
- - syslog(LOG_ERR, "Can't find in which sub network the client is");
- + syslog(LOG_INFO, "Can't find in which sub network the client %s is",
- + sender_str);
- return;
- }
- announced_host = lan_addr->str;
- diff -ur miniupnpd-1.7.20120824/miniupnpd.c miniupnpd-1.7.20120824.b/miniupnpd.c
- --- miniupnpd-1.7.20120824/miniupnpd.c 2012-08-22 01:11:41.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/miniupnpd.c 2012-09-04 18:42:17.221295126 +0800
- @@ -1101,6 +1101,7 @@
- }
-
- openlog("miniupnpd", openlog_option, LOG_MINIUPNPD);
- + syslog(LOG_INFO, "version " MINIUPNPD_VERSION " started");
-
- if(!debug_flag)
- {
- @@ -1448,6 +1449,9 @@
- }
- #endif
- should_send_public_address_change_notif = 0;
- +#ifdef ENABLE_LEASEFILE
- + reload_from_lease_file();
- +#endif
- }
- /* Check if we need to send SSDP NOTIFY messages and do it if
- * needed */
- @@ -1759,7 +1763,7 @@
- {
- /* ignore EAGAIN, EWOULDBLOCK, EINTR, we just try again later */
- if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)
- - syslog(LOG_ERR, "accept(http): %m");
- + syslog(LOG_DEBUG, "accept(http): %m");
- }
- else
- {
- diff -ur miniupnpd-1.7.20120824/natpmp.c miniupnpd-1.7.20120824.b/natpmp.c
- --- miniupnpd-1.7.20120824/natpmp.c 2012-05-28 07:12:51.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/natpmp.c 2012-09-04 18:42:17.221295126 +0800
- @@ -97,7 +97,7 @@
- resp[3] = 3; /* Network Failure (e.g. NAT box itself
- * has not obtained a DHCP lease) */
- } else if(getifaddr(ext_if_name, tmp, INET_ADDRSTRLEN) < 0) {
- - syslog(LOG_ERR, "Failed to get IP for interface %s", ext_if_name);
- + syslog(LOG_DEBUG, "Failed to get IP for interface %s", ext_if_name);
- resp[3] = 3; /* Network Failure (e.g. NAT box itself
- * has not obtained a DHCP lease) */
- } else {
- @@ -220,7 +220,7 @@
- r = _upnp_delete_redir(eport2, proto2);
- /* TODO : check return value */
- if(r<0) {
- - syslog(LOG_ERR, "failed to remove port mapping");
- + syslog(LOG_DEBUG, "failed to remove port mapping");
- index++;
- } else {
- syslog(LOG_INFO, "NAT-PMP %s port %hu mapping removed",
- @@ -237,7 +237,7 @@
- r = _upnp_delete_redir(eport, proto);
- /*syslog(LOG_DEBUG, "%hu %d r=%d", eport, proto, r);*/
- if(r<0) {
- - syslog(LOG_ERR, "Failed to remove NAT-PMP mapping eport %hu, protocol %s",
- + syslog(LOG_DEBUG, "Failed to remove NAT-PMP mapping eport %hu, protocol %s",
- eport, (proto==IPPROTO_TCP)?"TCP":"UDP");
- resp[3] = 2; /* Not Authorized/Refused */
- }
- @@ -259,7 +259,7 @@
- eport, (proto==IPPROTO_TCP)?"tcp":"udp", iaddr_old, iport_old);
- /* remove and then add again */
- if(_upnp_delete_redir(eport, proto) < 0) {
- - syslog(LOG_ERR, "failed to remove port mapping");
- + syslog(LOG_DEBUG, "failed to remove port mapping");
- break;
- }
- } else {
- @@ -282,7 +282,7 @@
- if(upnp_redirect_internal(NULL, eport, senderaddrstr,
- iport, proto, desc,
- timestamp) < 0) {
- - syslog(LOG_ERR, "Failed to add NAT-PMP %hu %s->%s:%hu '%s'",
- + syslog(LOG_DEBUG, "Failed to add NAT-PMP %hu %s->%s:%hu '%s'",
- eport, (proto==IPPROTO_TCP)?"tcp":"udp", senderaddrstr, iport, desc);
- resp[3] = 3; /* Failure */
- #if 0
- @@ -308,7 +308,7 @@
- n = sendto(s, resp, resplen, 0,
- (struct sockaddr *)&senderaddr, sizeof(senderaddr));
- if(n<0) {
- - syslog(LOG_ERR, "sendto(natpmp): %m");
- + syslog(LOG_DEBUG, "sendto(natpmp): %m");
- } else if(n<resplen) {
- syslog(LOG_ERR, "sendto(natpmp): sent only %d bytes out of %d",
- n, resplen);
- diff -ur miniupnpd-1.7.20120824/netfilter/iptcrdr.c miniupnpd-1.7.20120824.b/netfilter/iptcrdr.c
- --- miniupnpd-1.7.20120824/netfilter/iptcrdr.c 2012-05-01 17:11:16.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/netfilter/iptcrdr.c 2012-09-10 00:58:17.970067787 +0800
- @@ -18,7 +18,7 @@
-
- #include <linux/version.h>
-
- -#if IPTABLES_143
- +#ifdef IPTABLES_143
- /* IPTABLES API version >= 1.4.3 */
-
- /* added in order to compile on gentoo :
- @@ -40,7 +40,7 @@
- #else
- /* IPTABLES API version < 1.4.3 */
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
- -#include <linux/netfilter_ipv4/ip_nat.h>
- +#include <linux/netfilter/nf_nat.h>
- #else
- #if 0
- #include <linux/netfilter/nf_nat.h>
- diff -ur miniupnpd-1.7.20120824/upnpdescstrings.h miniupnpd-1.7.20120824.b/upnpdescstrings.h
- --- miniupnpd-1.7.20120824/upnpdescstrings.h 2012-02-05 07:05:26.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/upnpdescstrings.h 2012-09-04 18:42:17.221295126 +0800
- @@ -11,10 +11,10 @@
-
- /* strings used in the root device xml description */
- /*#define ROOTDEV_FRIENDLYNAME OS_NAME " router"*/
- -#define ROOTDEV_MANUFACTURER OS_NAME
- -#define ROOTDEV_MANUFACTURERURL OS_URL
- -#define ROOTDEV_MODELNAME OS_NAME " router"
- -#define ROOTDEV_MODELDESCRIPTION OS_NAME " router"
- +#define ROOTDEV_MANUFACTURER "Wive-NG-RTNL"
- +#define ROOTDEV_MANUFACTURERURL "http://wive-ng.sourceforge.net/"
- +#define ROOTDEV_MODELNAME "Wireless Router"
- +#define ROOTDEV_MODELDESCRIPTION OS_NAME " Router"
- #define ROOTDEV_MODELURL OS_URL
-
- #define WANDEV_FRIENDLYNAME "WANDevice"
- diff -ur miniupnpd-1.7.20120824/upnpevents.c miniupnpd-1.7.20120824.b/upnpevents.c
- --- miniupnpd-1.7.20120824/upnpevents.c 2012-05-01 17:11:15.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/upnpevents.c 2012-09-04 18:42:17.221295126 +0800
- @@ -376,7 +376,7 @@
- i = send(obj->s, obj->buffer + obj->sent, obj->tosend - obj->sent, 0);
- if(i<0) {
- if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
- - syslog(LOG_NOTICE, "%s: send(): %m", "upnp_event_send");
- + syslog(LOG_DEBUG, "%s: send(): %m", "upnp_event_send");
- obj->state = EError;
- return;
- } else {
- @@ -400,7 +400,7 @@
- if(errno != EAGAIN &&
- errno != EWOULDBLOCK &&
- errno != EINTR) {
- - syslog(LOG_ERR, "%s: recv(): %m", "upnp_event_recv");
- + syslog(LOG_DEBUG, "%s: recv(): %m", "upnp_event_recv");
- obj->state = EError;
- }
- return;
- diff -ur miniupnpd-1.7.20120824/upnpglobalvars.c miniupnpd-1.7.20120824.b/upnpglobalvars.c
- --- miniupnpd-1.7.20120824/upnpglobalvars.c 2012-04-26 22:35:49.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/upnpglobalvars.c 2012-09-04 18:42:17.221295126 +0800
- @@ -73,10 +73,10 @@
- #ifdef USE_NETFILTER
- /* chain name to use, both in the nat table
- * and the filter table */
- -const char * miniupnpd_nat_chain = "MINIUPNPD";
- -const char * miniupnpd_forward_chain = "MINIUPNPD";
- +const char * miniupnpd_nat_chain = "UPNP";
- +const char * miniupnpd_forward_chain = "UPNP";
- #ifdef ENABLE_6FC_SERVICE
- -const char * miniupnpd_v6_filter_chain = "MINIUPNPD";
- +const char * miniupnpd_v6_filter_chain = "UPNP";
- #endif
-
- #endif
- diff -ur miniupnpd-1.7.20120824/upnphttp.c miniupnpd-1.7.20120824.b/upnphttp.c
- --- miniupnpd-1.7.20120824/upnphttp.c 2012-05-28 21:26:58.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/upnphttp.c 2012-09-04 18:43:27.969838251 +0800
- @@ -12,6 +12,7 @@
- #include <string.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- +#include <arpa/inet.h>
- #include <sys/param.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- @@ -514,7 +515,7 @@
- return;
- }
- #endif
- - syslog(LOG_NOTICE, "%s not found, responding ERROR 404", HttpUrl);
- + syslog(LOG_INFO, "%s not found, responding ERROR 404", HttpUrl);
- Send404(h);
- }
- #ifdef ENABLE_EVENTS
- @@ -568,7 +569,8 @@
- }
- else if(n==0)
- {
- - syslog(LOG_WARNING, "HTTP Connection closed unexpectedly");
- + syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly",
- + inet_ntoa(h->clientaddr));
- h->state = EToDelete;
- }
- else
- @@ -604,7 +606,8 @@
- }
- else if(n==0)
- {
- - syslog(LOG_WARNING, "HTTP Connection closed inexpectedly");
- + syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly",
- + inet_ntoa(h->clientaddr));
- h->state = EToDelete;
- }
- else
- diff -ur miniupnpd-1.7.20120824/upnpredirect.c miniupnpd-1.7.20120824.b/upnpredirect.c
- --- miniupnpd-1.7.20120824/upnpredirect.c 2012-05-02 04:11:50.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/upnpredirect.c 2012-09-04 18:42:17.221295126 +0800
- @@ -165,7 +165,7 @@
- if(!lease_file) return -1;
- fd = fopen( lease_file, "r");
- if (fd==NULL) {
- - syslog(LOG_ERR, "could not open lease file: %s", lease_file);
- + syslog(LOG_DEBUG, "could not open lease file: %s", lease_file);
- return -1;
- }
- if(unlink(lease_file) < 0) {
- @@ -287,14 +287,20 @@
- * xbox 360 does not keep track of the port it redirects and will
- * redirect another port when receiving ConflictInMappingEntry */
- if(strcmp(iaddr, iaddr_old)==0 && iport==iport_old) {
- - syslog(LOG_INFO, "ignoring redirect request as it matches existing redirect");
- + /* redirection allready exists */
- + syslog(LOG_INFO, "port %hu %s already redirected to %s:%hu, replacing", eport, (proto==IPPROTO_TCP)?"tcp":"udp", iaddr_old, iport_old);
- + /* remove and then add again */
- + if(_upnp_delete_redir(eport, proto) < 0) {
- + syslog(LOG_ERR, "failed to remove port mapping");
- + return 0;
- + }
- } else {
-
- syslog(LOG_INFO, "port %hu protocol %s already redirected to %s:%hu",
- eport, protocol, iaddr_old, iport_old);
- return -2;
- }
- - } else {
- + }
- timestamp = (leaseduration > 0) ? time(NULL) + leaseduration : 0;
- syslog(LOG_INFO, "redirecting port %hu to %s:%hu protocol %s for: %s",
- eport, iaddr, iport, protocol, desc);
- @@ -302,9 +308,6 @@
- desc, timestamp);
- }
-
- - return 0;
- -}
- -
- int
- upnp_redirect_internal(const char * rhost, unsigned short eport,
- const char * iaddr, unsigned short iport,
- @@ -511,7 +514,7 @@
- {
- if(tmp->to_remove)
- {
- - syslog(LOG_NOTICE, "remove port mapping %hu %s because it has expired",
- + syslog(LOG_INFO, "remove port mapping %hu %s because it has expired",
- tmp->eport, (tmp->proto==IPPROTO_TCP)?"TCP":"UDP");
- _upnp_delete_redir(tmp->eport, tmp->proto);
- *p = tmp->next;
- @@ -553,7 +556,7 @@
- {
- if(packets == list->packets && bytes == list->bytes)
- {
- - _upnp_delete_redir(list->eport, list->proto);
- + if(_upnp_delete_redir(list->eport, list->proto) >= 0)
- n++;
- }
- }
- diff -ur miniupnpd-1.7.20120824/upnpsoap.c miniupnpd-1.7.20120824.b/upnpsoap.c
- --- miniupnpd-1.7.20120824/upnpsoap.c 2012-05-25 02:05:47.000000000 +0800
- +++ miniupnpd-1.7.20120824.b/upnpsoap.c 2012-09-04 18:42:17.221295126 +0800
- @@ -271,7 +271,7 @@
- }
- else if(getifaddr(ext_if_name, ext_ip_addr, INET_ADDRSTRLEN) < 0)
- {
- - syslog(LOG_ERR, "Failed to get ip address for interface %s",
- + syslog(LOG_DEBUG, "Failed to get ip address for interface %s",
- ext_if_name);
- strncpy(ext_ip_addr, "0.0.0.0", INET_ADDRSTRLEN);
- }
- @@ -355,7 +355,7 @@
- }
- else
- {
- - syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip);
- + syslog(LOG_DEBUG, "Failed to convert hostname '%s' to ip address", int_ip);
- ClearNameValueList(&data);
- SoapError(h, 402, "Invalid Args");
- return;
- @@ -522,7 +522,7 @@
- }
- else
- {
- - syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip);
- + syslog(LOG_DEBUG, "Failed to convert hostname '%s' to ip address", int_ip);
- ClearNameValueList(&data);
- SoapError(h, 402, "Invalid Args");
- return;
- @@ -1113,7 +1113,7 @@
- }
- else
- {
- - syslog(LOG_NOTICE, "%s: Unknown: %s", action, var_name?var_name:"");
- + syslog(LOG_DEBUG, "%s: Unknown: %s", action, var_name?var_name:"");
- SoapError(h, 404, "Invalid Var");
- }
-
- @@ -1246,7 +1246,7 @@
- }
- else
- {
- - syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip);
- + syslog(LOG_DEBUG, "Failed to convert hostname '%s' to ip address", int_ip);
- SoapError(h, 402, "Invalid Args");
- return -1;
- }
- @@ -1836,7 +1836,7 @@
- i++;
- }
-
- - syslog(LOG_NOTICE, "SoapMethod: Unknown: %.*s", methodlen, p);
- + syslog(LOG_DEBUG, "SoapMethod: Unknown: %.*s", methodlen, p);
- }
-
- SoapError(h, 401, "Invalid Action");
- @@ -1884,7 +1884,7 @@
- char body[2048];
- int bodylen;
-
- - syslog(LOG_INFO, "Returning UPnPError %d: %s", errCode, errDesc);
- + syslog(LOG_DEBUG, "Returning UPnPError %d: %s", errCode, errDesc);
- bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
- BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
- SendRespAndClose_upnphttp(h);