transmission: add missing file in prepackaged source build for tr 3.00

arm-sdk7
pedro 4 years ago
parent 78aeb95197
commit 5ddf368962

@ -29,11 +29,13 @@ CFLAGS += -fno-strict-aliasing
CFLAGS += -fno-common
CFLAGS += -fstack-protector -fPIE
CFLAGS += -D_FORTIFY_SOURCE=2
CPPFLAGS += -D_GNU_SOURCE
CFLAGS += -D_GNU_SOURCE
CFLAGS += -Wall
CFLAGS += -Wextra -Wstrict-prototypes -Wdeclaration-after-statement
#CFLAGS += -Wno-missing-field-initializers
#CFLAGS += -ansi # iptables headers does use typeof which is a gcc extension
CFLAGS += $(EXTRACFLAGS)
CPPFLAGS += -I$(TOP)/shared
LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
CC ?= gcc
RM = rm -f
@ -41,7 +43,7 @@ INSTALL = install
STRIP ?= strip
PKG_CONFIG ?= pkg-config
CP = cp
DOXYGEN ?= doxygen
#DOXYGEN ?= doxygen
DEPFLAGS = -MM -MG -MT $(patsubst %.d,%.o,$@) -MT $@
# -M : with system headers, -MM : without
@ -52,7 +54,7 @@ ETCINSTALLDIR = $(PREFIX)/etc/miniupnpd
MANINSTALLDIR = $(INSTALLPREFIX)/share/man/man8
include config.mk
include $(SRCDIR)/gitrev.mk
#include $(SRCDIR)/gitrev.mk
include $(SRCDIR)/objects.mk
# sources in netfilter/ directory
@ -87,12 +89,12 @@ endif # ifneq ($(IPTABLES_PCFILE_FOUND),1)
ifeq ($(TARGET_OPENWRT),)
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1)
ifeq ($(TEST),1)
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid)
else
$(info please install uuid-dev package / libuuid)
endif # ($(TEST),1)
#TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1)
#ifeq ($(TEST),1)
#LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid)
#else
#$(info please install uuid-dev package / libuuid)
#endif # ($(TEST),1)
endif # ($(TARGET_OPENWRT,)
GLIBC_VERSION := $(shell ldd --version | head -n 1 | sed 's/^.* //')
@ -105,10 +107,11 @@ LDLIBS += $(shell if [ $(GLIBC_VERSION_MAJOR) -lt 2 ] \
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
testupnppermissions miniupnpdctl testgetifaddr \
testgetroute testasyncsendto testportinuse \
testssdppktgen testminissdp
EXECUTABLES = miniupnpd
#EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
# testupnppermissions miniupnpdctl testgetifaddr \
# testgetroute testasyncsendto testportinuse \
# testssdppktgen testminissdp
.PHONY: all clean install depend dox

@ -114,11 +114,11 @@ if [ -f ./os.astlinux ]; then
OS_VERSION=$(cat ./os.astlinux)
fi
# Tomato USB special case
# FreshTomato special case
if [ -f ../shared/tomato_version ]; then
OS_NAME=Tomato
TOMATO_VER=`cat ../shared/tomato_version | cut -d' ' -f2,3`
OS_VERSION="Tomato $TOMATO_VER"
TOMATO_VER=`cat ../shared/tomato_version | cut -d' ' -f1,2`
OS_VERSION="FreshTomato $TOMATO_VER"
fi
# OpenEmbedded special case
@ -396,8 +396,8 @@ case $OS_NAME in
FW=iptables
;;
Tomato)
OS_NAME=UPnP
OS_URL=http://tomatousb.org/
OS_NAME=FreshTomato
OS_URL=https://freshtomato.org/
echo "" >> ${CONFIGFILE}
echo "#ifndef TOMATO" >> ${CONFIGFILE}
echo "#define TOMATO" >> ${CONFIGFILE}
@ -409,6 +409,7 @@ case $OS_NAME in
echo "#ifdef TCONFIG_IPV6" >> ${CONFIGFILE}
echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
echo "#endif" >> ${CONFIGFILE}
HAVE_IP_MREQN=1
FW=iptables
;;
Darwin)
@ -490,8 +491,14 @@ case $FW in
fi
if [ "$IPTABLES_143" -eq 1 ] ; then
echo "LDLIBS += ${IPTABLESPATH}/libiptc/.libs/libip4tc.o" >> config.mk
if [ "$TCONFIG_IPV6" = "y" ]; then
echo "LDLIBS += ${IPTABLESPATH}/libiptc/.libs/libip6tc.o" >> config.mk
fi
else
echo "LDLIBS += ${IPTABLESPATH}/libiptc/libiptc.a" >> config.mk
if [ "$TCONFIG_IPV6" = "y" ]; then
echo "LDLIBS += ${IPTABLESPATH}/libiptc/libip6tc.a" >> config.mk
fi
fi
else
# OpenWRT

@ -24,6 +24,8 @@
#include "getifaddr.h"
#if defined(USE_GETIFADDRS) || defined(ENABLE_IPV6) || defined(ENABLE_PCP)
#include <ifaddrs.h>
/* FreshTomato ARM - add getifaddr support (missing) */
#include "ifaddrs.c"
#endif
int

@ -1009,11 +1009,13 @@ parselanaddr(struct lan_addr_s * lan_addr, const char * str)
fprintf(stderr, "Error parsing address : %s\n", lan_addr->ext_ip_str);
return -1;
}
#if 0
if(addr_is_reserved(&lan_addr->ext_ip_addr)) {
/* error */
fprintf(stderr, "Error: option ext_ip address contains reserved / private address : %s\n", lan_addr->ext_ip_str);
return -1;
}
#endif
}
}
#else
@ -1102,15 +1104,15 @@ int update_ext_ip_addr_from_stun(int init)
syslog(LOG_INFO, "STUN: ext interface %s has now public IP address %s and firewall does not block incoming connections set by miniunnpd", ext_if_name, if_addr_str);
syslog(LOG_INFO, "Port forwarding is now enabled");
} else if ((init || !disable_port_forwarding) && restrictive_nat) {
if (addr_is_reserved(&if_addr)) {
syslog(LOG_WARNING, "STUN: ext interface %s with private IP address %s is now behind restrictive or symmetric NAT with public IP address %s which does not support port forwarding", ext_if_name, if_addr_str, ext_addr_str);
syslog(LOG_WARNING, "NAT on upstream router blocks incoming connections set by miniupnpd");
syslog(LOG_WARNING, "Turn off NAT on upstream router or change it to full-cone NAT 1:1 type");
} else {
syslog(LOG_WARNING, "STUN: ext interface %s has now public IP address %s but firewall filters incoming connections set by miniunnpd", ext_if_name, if_addr_str);
syslog(LOG_WARNING, "Check configuration of firewall on local machine and also on upstream router");
}
syslog(LOG_WARNING, "Port forwarding is now disabled");
// if (addr_is_reserved(&if_addr)) {
// syslog(LOG_WARNING, "STUN: ext interface %s with private IP address %s is now behind restrictive or symmetric NAT with public IP address %s which does not support port forwarding", ext_if_name, if_addr_str, ext_addr_str);
// syslog(LOG_WARNING, "NAT on upstream router blocks incoming connections set by miniupnpd");
// syslog(LOG_WARNING, "Turn off NAT on upstream router or change it to full-cone NAT 1:1 type");
// } else {
// syslog(LOG_WARNING, "STUN: ext interface %s has now public IP address %s but firewall filters incoming connections set by miniunnpd", ext_if_name, if_addr_str);
// syslog(LOG_WARNING, "Check configuration of firewall on local machine and also on upstream router");
// }
syslog(LOG_WARNING, "STUN: ext interface %s with IP address %s is now behind restrictive NAT with public IP address %s: Port forwarding might not work properly", ext_if_name, if_addr_str, ext_addr_str);
} else {
syslog(LOG_INFO, "STUN: ... done");
}
@ -1779,10 +1781,12 @@ init(int argc, char * * argv, struct runtime_vars * v)
fprintf(stderr, "Error: option ext_ip contains invalid address %s\n", use_ext_ip_addr);
return 1;
}
#if 0
if (addr_is_reserved(&addr)) {
fprintf(stderr, "Error: option ext_ip contains reserved / private address %s, not public routable\n", use_ext_ip_addr);
return 1;
}
#endif
}
#ifndef NO_BACKGROUND_NO_PIDFILE
@ -2191,11 +2195,11 @@ main(int argc, char * * argv)
if (getifaddr(ext_if_name, if_addr, INET_ADDRSTRLEN, &addr, NULL) < 0) {
syslog(LOG_WARNING, "Cannot get IP address for ext interface %s. Network is down", ext_if_name);
} else if (addr_is_reserved(&addr)) {
syslog(LOG_INFO, "Reserved / private IP address %s on ext interface %s: Port forwarding is impossible", if_addr, ext_if_name);
syslog(LOG_INFO, "You are probably behind NAT, enable option ext_perform_stun=yes to detect public IP address");
syslog(LOG_INFO, "Or use ext_ip= / -o option to declare public IP address");
syslog(LOG_INFO, "Public IP address is required by UPnP/PCP/PMP protocols and clients do not work without it");
disable_port_forwarding = 1;
// syslog(LOG_INFO, "Reserved / private IP address %s on ext interface %s: Port forwarding is impossible", if_addr, ext_if_name);
// syslog(LOG_INFO, "You are probably behind NAT, enable option ext_perform_stun=yes to detect public IP address");
// syslog(LOG_INFO, "Or use ext_ip= / -o option to declare public IP address");
// syslog(LOG_INFO, "Public IP address is required by UPnP/PCP/PMP protocols and clients do not work without it");
// disable_port_forwarding = 1;
}
}
@ -2464,12 +2468,12 @@ main(int argc, char * * argv)
if (disable_port_forwarding && !reserved) {
syslog(LOG_INFO, "Public IP address %s on ext interface %s: Port forwarding is enabled", if_addr, ext_if_name);
} else if (!disable_port_forwarding && reserved) {
syslog(LOG_INFO, "Reserved / private IP address %s on ext interface %s: Port forwarding is impossible", if_addr, ext_if_name);
syslog(LOG_INFO, "You are probably behind NAT, enable option ext_perform_stun=yes to detect public IP address");
syslog(LOG_INFO, "Or use ext_ip= / -o option to declare public IP address");
syslog(LOG_INFO, "Public IP address is required by UPnP/PCP/PMP protocols and clients do not work without it");
syslog(LOG_INFO, "Reserved / private IP address %s on ext interface %s: Port forwarding might not work properly", if_addr, ext_if_name);
// syslog(LOG_INFO, "You are probably behind NAT, enable option ext_perform_stun=yes to detect public IP address");
// syslog(LOG_INFO, "Or use ext_ip= / -o option to declare public IP address");
// syslog(LOG_INFO, "Public IP address is required by UPnP/PCP/PMP protocols and clients do not work without it");
}
disable_port_forwarding = reserved;
// disable_port_forwarding = reserved;
}
}
#ifdef ENABLE_NATPMP

@ -108,9 +108,11 @@ static void FillPublicAddressResponse(unsigned char * resp, in_addr_t senderaddr
syslog(LOG_ERR, "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) */
#if 0
} else if (addr_is_reserved(&addr)) {
resp[3] = 3; /* Network Failure, box has not obtained
public IP address */
#endif
} else {
inet_pton(AF_INET, tmp, resp+8); /* ok */
}

@ -1290,7 +1290,7 @@ genEventVars(int * len, const struct serviceDesc * s)
else {
struct in_addr addr;
char ext_ip_addr[INET_ADDRSTRLEN];
if(getifaddr(ext_if_name, ext_ip_addr, INET_ADDRSTRLEN, &addr, NULL) < 0 || addr_is_reserved(&addr)) {
if(getifaddr(ext_if_name, ext_ip_addr, INET_ADDRSTRLEN, &addr, NULL) < 0) {
str = strcat_str(str, len, &tmplen, "0.0.0.0");
} else {
str = strcat_str(str, len, &tmplen, ext_ip_addr);

@ -346,9 +346,11 @@ GetExternalIPAddress(struct upnphttp * h, const char * action, const char * ns)
syslog(LOG_ERR, "Failed to get ip address for interface %s",
ext_if_name);
ext_ip_addr[0] = '\0';
#if 0
} else if (addr_is_reserved(&addr)) {
syslog(LOG_NOTICE, "private/reserved address %s is not suitable for external IP", ext_ip_addr);
ext_ip_addr[0] = '\0';
#endif
}
}
#else

@ -0,0 +1,48 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set __argc=0
for %%i in (%*) do (
set /a __argc+=1
set "__argv[!__argc!]=%%~i"
)
set "result_path=!__argv[1]!"
set "test_action=!__argv[2]!"
set "temp_result_path=%result_path%.tmp"
>"%temp_result_path%" <nul set /p=
if "%test_action%" == "--dump-args" goto dump_args
if "%test_action%" == "--dump-env" goto dump_env
if "%test_action%" == "--dump-cwd" goto dump_cwd
exit /b 1
:dump_args
for /l %%i in (3,1,%__argc%) do (
>>"%temp_result_path%" echo.!__argv[%%i]!
)
goto finish
:dump_env
for /l %%i in (3,1,%__argc%) do (
>>"%temp_result_path%" call :dump_env_var "!__argv[%%i]!"
)
goto finish
:dump_env_var
if defined %~1 (
echo.!%~1!
) else (
echo.^<null^>
)
exit /b 0
:dump_cwd
>>"%temp_result_path%" echo.%CD%
goto finish
:finish
>nul move /y "%temp_result_path%" "%result_path%"
exit /b 0
Loading…
Cancel
Save