mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 11:17:34 +08:00
update 2023-01-31 23:36:55
This commit is contained in:
parent
0a63134435
commit
2841e80fc3
@ -1,80 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=miniupnpd
|
||||
PKG_VERSION:=2.0.20170421
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_URL:=http://miniupnp.tuxfamily.org/files
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_HASH:=9677aeccadf73b4bf8bb9d832c32b5da8266b4d58eed888f3fd43d7656405643
|
||||
|
||||
PKG_MAINTAINER:=Markus Stenberg <fingon@iki.fi>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/miniupnpd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+iptables +libip4tc +libuuid
|
||||
TITLE:=Lightweight UPnP IGD, NAT-PMP & PCP daemon
|
||||
SUBMENU:=Firewall
|
||||
URL:=http://miniupnp.free.fr/
|
||||
endef
|
||||
|
||||
define Package/miniupnpd/config
|
||||
config MINIUPNPD_IGDv2
|
||||
bool
|
||||
default n
|
||||
prompt "Enable IGDv2"
|
||||
endef
|
||||
|
||||
define Package/miniupnpd/conffiles
|
||||
/etc/config/upnpd
|
||||
endef
|
||||
|
||||
define Package/miniupnpd/postinst
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$$IPKG_INSTROOT" ]; then
|
||||
( . /etc/uci-defaults/99-miniupnpd )
|
||||
rm -f /etc/uci-defaults/99-miniupnpd
|
||||
fi
|
||||
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
echo "OpenWrt" | tr \(\)\ _ >$(PKG_BUILD_DIR)/os.openwrt
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
TARGET_OPENWRT=1 TEST=0 \
|
||||
LIBS="" \
|
||||
CC="$(TARGET_CC) -DIPTABLES_143 \
|
||||
-lip4tc -luuid" \
|
||||
CONFIG_OPTIONS="--portinuse --leasefile \
|
||||
$(if $(CONFIG_MINIUPNPD_IGDv2),--igd2)" \
|
||||
-f Makefile.linux \
|
||||
miniupnpd
|
||||
|
||||
|
||||
define Package/miniupnpd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults $(1)/etc/hotplug.d/iface $(1)/usr/share/miniupnpd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/sbin/miniupnpd
|
||||
$(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
|
||||
$(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
|
||||
$(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/iface/50-miniupnpd
|
||||
$(INSTALL_DATA) ./files/miniupnpd.defaults $(1)/etc/uci-defaults/99-miniupnpd
|
||||
$(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/miniupnpd/firewall.include
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,miniupnpd))
|
@ -1,57 +0,0 @@
|
||||
#!/bin/sh
|
||||
# miniupnpd integration for firewall3
|
||||
|
||||
IP6TABLES=/usr/sbin/ip6tables
|
||||
|
||||
iptables -t filter -N MINIUPNPD 2>/dev/null
|
||||
iptables -t nat -N MINIUPNPD 2>/dev/null
|
||||
iptables -t nat -N MINIUPNPD-POSTROUTING 2>/dev/null
|
||||
|
||||
[ -x $IP6TABLES ] && $IP6TABLES -t filter -N MINIUPNPD 2>/dev/null
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
ADDED=0
|
||||
|
||||
add_extzone_rules() {
|
||||
local ext_zone=$1
|
||||
|
||||
[ -z "$ext_zone" ] && return
|
||||
|
||||
# IPv4 - due to NAT, need to add both to nat and filter table
|
||||
iptables -t filter -I zone_${ext_zone}_forward -j MINIUPNPD
|
||||
iptables -t nat -I zone_${ext_zone}_prerouting -j MINIUPNPD
|
||||
iptables -t nat -I zone_${ext_zone}_postrouting -j MINIUPNPD-POSTROUTING
|
||||
|
||||
# IPv6 if available - filter only
|
||||
[ -x $IP6TABLES ] && {
|
||||
$IP6TABLES -t filter -I zone_${ext_zone}_forward -j MINIUPNPD
|
||||
}
|
||||
ADDED=$(($ADDED + 1))
|
||||
}
|
||||
|
||||
# By default, user configuration is king.
|
||||
|
||||
for ext_iface in $(uci -q get upnpd.config.external_iface); do
|
||||
add_extzone_rules $(fw3 -q network "$ext_iface")
|
||||
done
|
||||
|
||||
add_extzone_rules $(uci -q get upnpd.config.external_zone)
|
||||
|
||||
[ ! $ADDED = 0 ] && exit 0
|
||||
|
||||
|
||||
# If really nothing is available, resort to network_find_wan{,6} and
|
||||
# assume external interfaces all have same firewall zone.
|
||||
|
||||
# (This heuristic may fail horribly, in case of e.g. multihoming, so
|
||||
# please set external_zone in that case!)
|
||||
|
||||
network_find_wan wan_iface
|
||||
network_find_wan6 wan6_iface
|
||||
|
||||
for ext_iface in $wan_iface $wan6_iface; do
|
||||
# fw3 -q network fails on sub-interfaces => map to device first
|
||||
network_get_device ext_device $ext_iface
|
||||
add_extzone_rules $(fw3 -q device "$ext_device")
|
||||
done
|
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.miniupnpd
|
||||
set firewall.miniupnpd=include
|
||||
set firewall.miniupnpd.type=script
|
||||
set firewall.miniupnpd.path=/usr/share/miniupnpd/firewall.include
|
||||
set firewall.miniupnpd.family=any
|
||||
set firewall.miniupnpd.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
|
||||
exit 0
|
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/miniupnpd enabled || exit 0
|
||||
|
||||
. /lib/functions/service.sh
|
||||
|
||||
# If miniupnpd is not running:
|
||||
# - check on _any_ event (even updates may contribute to network_find_wan*)
|
||||
|
||||
# If miniupnpd _is_ running:
|
||||
# - check only on ifup (otherwise lease updates etc would cause
|
||||
# miniupnpd state loss)
|
||||
|
||||
[ ! "$ACTION" = "ifup" ] && service_check /usr/sbin/miniupnpd && exit 0
|
||||
|
||||
tmpconf="/var/etc/miniupnpd.conf"
|
||||
extiface=$(uci get upnpd.config.external_iface)
|
||||
extzone=$(uci get upnpd.config.external_zone)
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
for iface in $(uci get upnpd.config.internal_iface); do
|
||||
network_get_device device $iface
|
||||
[ "$DEVICE" = "$device" ] && /etc/init.d/miniupnpd restart && exit 0
|
||||
done
|
||||
|
||||
|
||||
if [ -z "$extiface" ] ; then
|
||||
# manual external zone (if dynamically find interfaces
|
||||
# belonging to it) overrides network_find_wan*
|
||||
if [ -n "$extzone" ] ; then
|
||||
ifname=$(fw3 -q zone $extzone | head -1)
|
||||
fi
|
||||
[ -n "$extiface" ] || network_find_wan extiface
|
||||
[ -n "$extiface" ] || network_find_wan6 extiface
|
||||
fi
|
||||
|
||||
[ -n "$ifname" ] || network_get_device ifname ${extiface}
|
||||
grep -q "ext_ifname=$ifname" $tmpconf || /etc/init.d/miniupnpd restart
|
@ -1,219 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
|
||||
START=94
|
||||
STOP=15
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/miniupnpd
|
||||
|
||||
upnpd_get_port_range() {
|
||||
local _var="$1"; shift
|
||||
local _val
|
||||
|
||||
config_get _val "$@"
|
||||
|
||||
case "$_val" in
|
||||
[0-9]*[:-][0-9]*)
|
||||
export -n -- "${_var}_start=${_val%%[:-]*}"
|
||||
export -n -- "${_var}_end=${_val##*[:-]}"
|
||||
;;
|
||||
[0-9]*)
|
||||
export -n -- "${_var}_start=$_val"
|
||||
export -n -- "${_var}_end="
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
conf_rule_add() {
|
||||
local cfg="$1"
|
||||
local tmpconf="$2"
|
||||
local action external_port_start external_port_end int_addr
|
||||
local internal_port_start internal_port_end
|
||||
|
||||
config_get action "$cfg" action "deny" # allow or deny
|
||||
upnpd_get_port_range "ext" "$cfg" ext_ports "0-65535" # external ports: x, x-y, x:y
|
||||
config_get int_addr "$cfg" int_addr "0.0.0.0/0" # ip or network and subnet mask (internal)
|
||||
upnpd_get_port_range "int" "$cfg" int_ports "0-65535" # internal ports: x, x-y, x:y or range
|
||||
|
||||
# Make a single IP IP/32 so that miniupnpd.conf can use it.
|
||||
case "$int_addr" in
|
||||
*/*) ;;
|
||||
*) int_addr="$int_addr/32" ;;
|
||||
esac
|
||||
|
||||
echo "${action} ${ext_start}${ext_end:+-}${ext_end} ${int_addr} ${int_start}${int_end:+-}${int_end}" >>$tmpconf
|
||||
}
|
||||
|
||||
upnpd_write_bool() {
|
||||
local opt="$1"
|
||||
local def="${2:-0}"
|
||||
local alt="$3"
|
||||
local val
|
||||
|
||||
config_get_bool val config "$opt" "$def"
|
||||
if [ "$val" -eq 0 ]; then
|
||||
echo "${alt:-$opt}=no" >> $tmpconf
|
||||
else
|
||||
echo "${alt:-$opt}=yes" >> $tmpconf
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
return
|
||||
}
|
||||
|
||||
upnpd() {
|
||||
config_load "upnpd"
|
||||
local extiface intiface upload download logging secure enabled natpmp
|
||||
local extip port usesysuptime conffile serial_number model_number
|
||||
local uuid notify_interval presentation_url enable_upnp
|
||||
local upnp_lease_file clean_ruleset_threshold clean_ruleset_interval
|
||||
local ipv6_listening_ip enabled
|
||||
|
||||
config_get_bool enabled config enabled 1
|
||||
|
||||
[ "$enabled" -gt 0 ] || return 1
|
||||
|
||||
config_get extiface config external_iface
|
||||
config_get extzone config external_zone
|
||||
config_get intiface config internal_iface
|
||||
config_get extip config external_ip
|
||||
config_get port config port 5000
|
||||
config_get upload config upload
|
||||
config_get download config download
|
||||
config_get_bool logging config log_output 0
|
||||
config_get conffile config config_file
|
||||
config_get serial_number config serial_number
|
||||
config_get model_number config model_number
|
||||
config_get uuid config uuid
|
||||
config_get notify_interval config notify_interval
|
||||
config_get presentation_url config presentation_url
|
||||
config_get upnp_lease_file config upnp_lease_file
|
||||
config_get clean_ruleset_threshold config clean_ruleset_threshold
|
||||
config_get clean_ruleset_interval config clean_ruleset_interval
|
||||
config_get ipv6_listening_ip config ipv6_listening_ip
|
||||
|
||||
local args
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
local ifname
|
||||
|
||||
# manual external interface overrides everything
|
||||
if [ -z "$extiface" ] ; then
|
||||
# manual external zone (if dynamically find interfaces
|
||||
# belonging to it) overrides network_find_wan*
|
||||
if [ -n "$extzone" ] ; then
|
||||
ifname=$(fw3 -q zone $extzone | head -1)
|
||||
fi
|
||||
[ -n "$extiface" ] || network_find_wan extiface
|
||||
[ -n "$extiface" ] || network_find_wan6 extiface
|
||||
fi
|
||||
|
||||
[ -n "$ifname" ] || network_get_device ifname ${extiface}
|
||||
|
||||
if [ -n "$conffile" ]; then
|
||||
args="-f $conffile"
|
||||
else
|
||||
local tmpconf="/var/etc/miniupnpd.conf"
|
||||
args="-f $tmpconf"
|
||||
mkdir -p /var/etc
|
||||
|
||||
echo "ext_ifname=$ifname" >$tmpconf
|
||||
|
||||
[ -n "$extip" ] && \
|
||||
echo "ext_ip=$extip" >>$tmpconf
|
||||
|
||||
local iface
|
||||
for iface in ${intiface:-lan}; do
|
||||
local device
|
||||
network_get_device device "$iface" && {
|
||||
echo "listening_ip=$device" >>$tmpconf
|
||||
}
|
||||
done
|
||||
|
||||
[ "$port" != "auto" ] && \
|
||||
echo "port=$port" >>$tmpconf
|
||||
|
||||
config_load "upnpd"
|
||||
upnpd_write_bool enable_natpmp 1
|
||||
upnpd_write_bool enable_upnp 1
|
||||
upnpd_write_bool secure_mode 1
|
||||
upnpd_write_bool pcp_allow_thirdparty 0
|
||||
upnpd_write_bool system_uptime 1
|
||||
|
||||
[ -n "$upnp_lease_file" ] && \
|
||||
echo "lease_file=$upnp_lease_file" >>$tmpconf
|
||||
|
||||
[ -n "$upload" -a -n "$download" ] && {
|
||||
echo "bitrate_down=$(($download * 1024 * 8))" >>$tmpconf
|
||||
echo "bitrate_up=$(($upload * 1024 * 8))" >>$tmpconf
|
||||
}
|
||||
|
||||
[ -n "${presentation_url}" ] && \
|
||||
echo "presentation_url=${presentation_url}" >>$tmpconf
|
||||
|
||||
[ -n "${notify_interval}" ] && \
|
||||
echo "notify_interval=${notify_interval}" >>$tmpconf
|
||||
|
||||
[ -n "${clean_ruleset_threshold}" ] && \
|
||||
echo "clean_ruleset_threshold=${clean_ruleset_threshold}" >>$tmpconf
|
||||
|
||||
[ -n "${clean_ruleset_interval}" ] && \
|
||||
echo "clean_ruleset_interval=${clean_ruleset_interval}" >>$tmpconf
|
||||
|
||||
[ -n "${ipv6_listening_ip}" ] && \
|
||||
echo "ipv6_listening_ip=${ipv6_listening_ip}" >>$tmpconf
|
||||
|
||||
[ -z "$uuid" ] && {
|
||||
uuid="$(cat /proc/sys/kernel/random/uuid)"
|
||||
uci set upnpd.config.uuid=$uuid
|
||||
uci commit upnpd
|
||||
}
|
||||
|
||||
[ "$uuid" = "nocli" ] || \
|
||||
echo "uuid=$uuid" >>$tmpconf
|
||||
|
||||
[ -n "${serial_number}" ] && \
|
||||
echo "serial=${serial_number}" >>$tmpconf
|
||||
|
||||
[ -n "${model_number}" ] && \
|
||||
echo "model_number=${model_number}" >>$tmpconf
|
||||
|
||||
config_foreach conf_rule_add perm_rule "$tmpconf"
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$ifname" ]; then
|
||||
# start firewall
|
||||
iptables -L MINIUPNPD >/dev/null 2>/dev/null || fw3 reload
|
||||
else
|
||||
logger -t "upnp daemon" "external interface not found, not starting"
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_append_param command -f "$tmpconf"
|
||||
[ "$log_output" = "1" ] && procd_append_param command -d
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
iptables -t nat -F MINIUPNPD 2>/dev/null
|
||||
iptables -t filter -F MINIUPNPD 2>/dev/null
|
||||
|
||||
[ -x /usr/sbin/ip6tables ] && {
|
||||
ip6tables -t filter -F MINIUPNPD 2>/dev/null
|
||||
}
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "upnpd"
|
||||
config_foreach upnpd "upnpd"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "upnpd"
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
config upnpd config
|
||||
option enabled 0
|
||||
option enable_natpmp 1
|
||||
option enable_upnp 1
|
||||
option secure_mode 1
|
||||
option log_output 0
|
||||
option download 1024
|
||||
option upload 512
|
||||
#by default, looked up dynamically from ubus
|
||||
#option external_iface wan
|
||||
option internal_iface lan
|
||||
option port 5000
|
||||
option upnp_lease_file /var/upnp.leases
|
||||
|
||||
config perm_rule
|
||||
option action allow
|
||||
option ext_ports 1024-65535
|
||||
option int_addr 0.0.0.0/0 # Does not override secure_mode
|
||||
option int_ports 1024-65535
|
||||
option comment "Allow high ports"
|
||||
|
||||
config perm_rule
|
||||
option action deny
|
||||
option ext_ports 0-65535
|
||||
option int_addr 0.0.0.0/0
|
||||
option int_ports 0-65535
|
||||
option comment "Default deny"
|
@ -1,25 +0,0 @@
|
||||
--- a/miniupnpd.c
|
||||
+++ b/miniupnpd.c
|
||||
@@ -1727,21 +1727,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
||||
}
|
||||
}
|
||||
|
||||
- if(debug_flag)
|
||||
- {
|
||||
- pid = getpid();
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
-#ifdef USE_DAEMON
|
||||
- if(daemon(0, 0)<0) {
|
||||
- perror("daemon()");
|
||||
- }
|
||||
- pid = getpid();
|
||||
-#else
|
||||
- pid = daemonize();
|
||||
-#endif
|
||||
- }
|
||||
+ pid = getpid();
|
||||
|
||||
openlog_option = LOG_PID|LOG_CONS;
|
||||
if(debug_flag)
|
@ -1,23 +0,0 @@
|
||||
We do not need to autodetect SSL/UUID; SSL we do not support, UUID we always do.
|
||||
|
||||
--- a/Makefile.linux
|
||||
+++ b/Makefile.linux
|
||||
@@ -153,14 +153,18 @@ LDLIBS += $(shell $(PKG_CONFIG) --static
|
||||
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
|
||||
endif # ($(TEST),1)
|
||||
|
||||
+ifeq ($(TARGET_OPENWRT),)
|
||||
+# n/a - we don't enable https server for IGD v2 anyway in OpenWrt
|
||||
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
|
||||
|
||||
+# n/a - we hardcodedly support libuuid
|
||||
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
|
||||
|
||||
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- a/pcpserver.c
|
||||
+++ b/pcpserver.c
|
||||
@@ -982,6 +982,7 @@ static int CreatePCPMap_NAT(pcp_info_t *
|
||||
timestamp);
|
||||
if (r < 0)
|
||||
return PCP_ERR_NO_RESOURCES;
|
||||
+ pcp_msg_info->ext_port = pcp_msg_info->int_port;
|
||||
return PCP_SUCCESS;
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
The miniupnpd makefile tries to autodetect iptables capabilities.
|
||||
This will incorrectly detect capabilities such as ipv6 support even though it is disabled for the target build.
|
||||
|
||||
As the OpenWRT buildsystem already passes the right compile flags, we can skip the autodetection.
|
||||
|
||||
|
||||
--- a/netfilter/Makefile
|
||||
+++ b/netfilter/Makefile
|
||||
@@ -38,8 +38,6 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
-LIBS += /lib/libip4tc.so /lib/libip6tc.so
|
||||
-
|
||||
all: iptcrdr.o testiptcrdr iptpinhole.o \
|
||||
testiptcrdr_peer testiptcrdr_dscp test_nfct_get
|
||||
# testiptpinhole
|
||||
--- a/Makefile.linux
|
||||
+++ b/Makefile.linux
|
||||
@@ -73,7 +73,6 @@ CPPFLAGS += -DIPTABLES_143
|
||||
endif
|
||||
|
||||
CFLAGS += $(shell $(PKG_CONFIG) --cflags libiptc)
|
||||
-LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libiptc)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L libiptc)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-other libiptc)
|
||||
else
|
@ -1,20 +0,0 @@
|
||||
As it turns out, the 'magic' libuuid/bsd uuid check just checks
|
||||
outside buildtree altogether for the uuid_generate. So we just
|
||||
hardcode it.
|
||||
|
||||
--- a/genconfig.sh
|
||||
+++ b/genconfig.sh
|
||||
@@ -367,12 +367,7 @@ case $FW in
|
||||
esac
|
||||
|
||||
# UUID API
|
||||
-if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then
|
||||
- echo "#define BSD_UUID" >> ${CONFIGFILE}
|
||||
-fi
|
||||
-if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then
|
||||
- echo "#define LIB_UUID" >> ${CONFIGFILE}
|
||||
-fi
|
||||
+echo "#define LIB_UUID" >> ${CONFIGFILE}
|
||||
|
||||
# set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
|
||||
if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then
|
@ -1,90 +0,0 @@
|
||||
--- a/netfilter/iptcrdr.c
|
||||
+++ b/netfilter/iptcrdr.c
|
||||
@@ -1116,9 +1116,13 @@ addnatrule(int proto, unsigned short epo
|
||||
} else {
|
||||
match = get_udp_match(eport, 0);
|
||||
}
|
||||
- e->nfcache = NFC_IP_DST_PT;
|
||||
+#ifdef NFC_UNKNOWN
|
||||
+ e->nfcache = NFC_UNKNOWN;
|
||||
+#endif
|
||||
target = get_dnat_target(iaddr, iport);
|
||||
- e->nfcache |= NFC_UNKNOWN;
|
||||
+#ifdef NFC_IP_DST_PT
|
||||
+ e->nfcache |= NFC_IP_DST_PT;
|
||||
+#endif
|
||||
tmp = realloc(e, sizeof(struct ipt_entry)
|
||||
+ match->u.match_size
|
||||
+ target->u.target_size);
|
||||
@@ -1186,9 +1190,13 @@ addmasqueraderule(int proto,
|
||||
} else {
|
||||
match = get_udp_match(0, iport);
|
||||
}
|
||||
- e->nfcache = NFC_IP_DST_PT;
|
||||
+#ifdef NFC_UNKNOWN
|
||||
+ e->nfcache = NFC_UNKNOWN;
|
||||
+#endif
|
||||
target = get_masquerade_target(eport);
|
||||
- e->nfcache |= NFC_UNKNOWN;
|
||||
+#ifdef NFC_IP_DST_PT
|
||||
+ e->nfcache |= NFC_IP_DST_PT;
|
||||
+#endif
|
||||
tmp = realloc(e, sizeof(struct ipt_entry)
|
||||
+ match->u.match_size
|
||||
+ target->u.target_size);
|
||||
@@ -1266,9 +1274,16 @@ addpeernatrule(int proto,
|
||||
} else {
|
||||
match = get_udp_match(rport, iport);
|
||||
}
|
||||
- e->nfcache = NFC_IP_DST_PT | NFC_IP_SRC_PT;
|
||||
+#ifdef NFC_UNKNOWN
|
||||
+ e->nfcache = NFC_UNKNOWN;
|
||||
+#endif
|
||||
target = get_snat_target(eaddr, eport);
|
||||
- e->nfcache |= NFC_UNKNOWN;
|
||||
+#ifdef NFC_IP_DST_PT
|
||||
+ e->nfcache |= NFC_IP_DST_PT;
|
||||
+#endif
|
||||
+#ifdef NFC_IP_SRC_PT
|
||||
+ e->nfcache |= NFC_IP_SRC_PT;
|
||||
+#endif
|
||||
tmp = realloc(e, sizeof(struct ipt_entry)
|
||||
+ match->u.match_size
|
||||
+ target->u.target_size);
|
||||
@@ -1337,9 +1352,16 @@ addpeerdscprule(int proto, unsigned char
|
||||
} else {
|
||||
match = get_udp_match(rport, iport);
|
||||
}
|
||||
- e->nfcache = NFC_IP_DST_PT | NFC_IP_SRC_PT;
|
||||
+#ifdef NFC_UNKNOWN
|
||||
+ e->nfcache = NFC_UNKNOWN;
|
||||
+#endif
|
||||
target = get_dscp_target(dscp);
|
||||
- e->nfcache |= NFC_UNKNOWN;
|
||||
+#ifdef NFC_IP_DST_PT
|
||||
+ e->nfcache |= NFC_IP_DST_PT;
|
||||
+#endif
|
||||
+#ifdef NFC_IP_SRC_PT
|
||||
+ e->nfcache |= NFC_IP_SRC_PT;
|
||||
+#endif
|
||||
tmp = realloc(e, sizeof(struct ipt_entry)
|
||||
+ match->u.match_size
|
||||
+ target->u.target_size);
|
||||
@@ -1420,11 +1442,15 @@ add_filter_rule(int proto, const char *
|
||||
} else {
|
||||
match = get_udp_match(iport,0);
|
||||
}
|
||||
- e->nfcache = NFC_IP_DST_PT;
|
||||
e->ip.dst.s_addr = inet_addr(iaddr);
|
||||
e->ip.dmsk.s_addr = INADDR_NONE;
|
||||
+#ifdef NFC_UNKNOWN
|
||||
+ e->nfcache = NFC_UNKNOWN;
|
||||
+#endif
|
||||
target = get_accept_target();
|
||||
- e->nfcache |= NFC_UNKNOWN;
|
||||
+#ifdef NFC_IP_DST_PT
|
||||
+ e->nfcache |= NFC_IP_DST_PT;
|
||||
+#endif
|
||||
tmp = realloc(e, sizeof(struct ipt_entry)
|
||||
+ match->u.match_size
|
||||
+ target->u.target_size);
|
@ -1,13 +0,0 @@
|
||||
--- a/minissdp.c 2017-04-21 19:24:23.000000000 +0800
|
||||
+++ b/minissdp.c 2021-06-22 07:01:24.000000000 +0800
|
||||
@@ -865,8 +865,8 @@
|
||||
lan_addr = get_lan_for_peer(sender);
|
||||
if(lan_addr == NULL)
|
||||
{
|
||||
- syslog(LOG_WARNING, "SSDP packet sender %s not from a LAN, ignoring",
|
||||
- sender_str);
|
||||
+ /* syslog(LOG_WARNING, "SSDP packet sender %s not from a LAN, ignoring",
|
||||
+ sender_str); */
|
||||
return;
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mwan3
|
||||
PKG_VERSION:=2.8.8
|
||||
PKG_RELEASE:=2
|
||||
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mwan3
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Routing and Redirection
|
||||
DEPENDS:= \
|
||||
+ip \
|
||||
+ipset \
|
||||
+iptables \
|
||||
+iptables-mod-conntrack-extra \
|
||||
+iptables-mod-ipopt \
|
||||
+jshn
|
||||
TITLE:=Multiwan hotplug script with connection tracking support
|
||||
MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/mwan3/description
|
||||
Hotplug script which makes configuration of multiple WAN interfaces simple
|
||||
and manageable. With loadbalancing/failover support for up to 250 wan
|
||||
interfaces, connection tracking and an easy to manage traffic ruleset.
|
||||
endef
|
||||
|
||||
define Package/mwan3/conffiles
|
||||
/etc/config/mwan3
|
||||
/etc/mwan3.user
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/mwan3/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/rpcd restart
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/mwan3/postrm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/rpcd restart
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/mwan3/install
|
||||
$(CP) ./files/* $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mwan3))
|
@ -1,23 +0,0 @@
|
||||
|
||||
config globals 'globals'
|
||||
option mmx_mask '0x3F00'
|
||||
option rtmon_interval '5'
|
||||
|
||||
config member 'wan_m1_w3'
|
||||
option interface 'wan'
|
||||
option metric '1'
|
||||
option weight '3'
|
||||
|
||||
config policy 'balanced'
|
||||
option last_resort 'default'
|
||||
list use_member 'wan_m1_w3'
|
||||
|
||||
config rule 'https'
|
||||
option sticky '1'
|
||||
option dest_port '443'
|
||||
option proto 'tcp'
|
||||
option use_policy 'balanced'
|
||||
|
||||
config rule 'default_rule'
|
||||
option dest_ip '0.0.0.0/0'
|
||||
option use_policy 'balanced'
|
@ -1,94 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
. /lib/mwan3/mwan3.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
[ "$ACTION" == "ifup" -o "$ACTION" == "ifdown" ] || exit 1
|
||||
[ -n "$INTERFACE" ] || exit 2
|
||||
|
||||
if [ "$ACTION" == "ifup" ]; then
|
||||
[ -n "$DEVICE" ] || exit 3
|
||||
fi
|
||||
|
||||
config_load mwan3
|
||||
config_get_bool enabled globals 'enabled' '0'
|
||||
[ ${enabled} -gt 0 ] || exit 0
|
||||
|
||||
mwan3_lock "$ACTION" "$INTERFACE"
|
||||
mwan3_init
|
||||
mwan3_set_connected_iptables
|
||||
mwan3_set_custom_ipset
|
||||
mwan3_unlock "$ACTION" "$INTERFACE"
|
||||
|
||||
config_get enabled $INTERFACE enabled 0
|
||||
config_get initial_state $INTERFACE initial_state "online"
|
||||
[ "$enabled" == "1" ] || exit 0
|
||||
|
||||
if [ "$ACTION" == "ifup" ]; then
|
||||
config_get family $INTERFACE family ipv4
|
||||
if [ "$family" = "ipv4" ]; then
|
||||
ubus call network.interface.${INTERFACE}_4 status &>/dev/null
|
||||
if [ "$?" -eq "0" ]; then
|
||||
network_get_ipaddr src_ip ${INTERFACE}_4
|
||||
else
|
||||
network_get_ipaddr src_ip ${INTERFACE}
|
||||
fi
|
||||
[ -n "$src_ip" ] || src_ip="0.0.0.0"
|
||||
elif [ "$family" = "ipv6" ]; then
|
||||
ubus call network.interface.${INTERFACE}_6 status &>/dev/null
|
||||
if [ "$?" -eq "0" ]; then
|
||||
network_get_ipaddr6 src_ip ${INTERFACE}_6
|
||||
else
|
||||
network_get_ipaddr6 src_ip ${INTERFACE}
|
||||
fi
|
||||
[ -n "$src_ip" ] || src_ip="::"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$initial_state" = "offline" ]; then
|
||||
json_load "$(ubus call mwan3 status '{"section":"interfaces"}')"
|
||||
json_select "interfaces"
|
||||
json_select "${INTERFACE}"
|
||||
json_get_var running running
|
||||
json_get_var status status
|
||||
else
|
||||
status=online
|
||||
running=1
|
||||
fi
|
||||
|
||||
mwan3_lock "$ACTION" "$INTERFACE"
|
||||
$LOG notice "Execute "$ACTION" event on interface $INTERFACE (${DEVICE:-unknown})"
|
||||
|
||||
case "$ACTION" in
|
||||
ifup)
|
||||
mwan3_set_general_rules
|
||||
mwan3_set_general_iptables
|
||||
mwan3_create_iface_iptables $INTERFACE $DEVICE
|
||||
mwan3_create_iface_rules $INTERFACE $DEVICE
|
||||
mwan3_create_iface_route $INTERFACE $DEVICE
|
||||
if [ ${running} -eq 1 -a "${status}" = "online" ]; then
|
||||
$LOG notice "Starting tracker on interface $INTERFACE (${DEVICE:-unknown})"
|
||||
mwan3_set_iface_hotplug_state $INTERFACE "online"
|
||||
mwan3_track $INTERFACE $DEVICE "online" "$src_ip"
|
||||
else
|
||||
$LOG notice "Starting tracker on interface $INTERFACE (${DEVICE:-unknown})"
|
||||
mwan3_set_iface_hotplug_state $INTERFACE "offline"
|
||||
mwan3_track $INTERFACE $DEVICE "offline" "$src_ip"
|
||||
fi
|
||||
mwan3_set_policies_iptables
|
||||
mwan3_set_user_rules
|
||||
;;
|
||||
ifdown)
|
||||
mwan3_set_iface_hotplug_state $INTERFACE "offline"
|
||||
mwan3_delete_iface_ipset_entries $INTERFACE
|
||||
mwan3_track_signal $INTERFACE $DEVICE
|
||||
mwan3_set_policies_iptables
|
||||
mwan3_set_user_rules
|
||||
;;
|
||||
esac
|
||||
|
||||
mwan3_unlock "$ACTION" "$INTERFACE"
|
||||
|
||||
exit 0
|
@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
. /lib/mwan3/mwan3.sh
|
||||
|
||||
config_load mwan3
|
||||
config_get_bool enabled globals 'enabled' '0'
|
||||
[ ${enabled} -gt 0 ] || exit 0
|
||||
|
||||
if [ "$ACTION" == "ifup" ]; then
|
||||
mwan3_lock "$ACTION" "mwan3rtmon"
|
||||
mwan3_rtmon
|
||||
mwan3_unlock "$ACTION" "mwan3rtmon"
|
||||
fi
|
||||
|
||||
config_get enabled $INTERFACE enabled 0
|
||||
[ "${enabled}" = "0" ] || {
|
||||
mwan3_flush_conntrack "$INTERFACE" "$ACTION"
|
||||
}
|
||||
|
||||
exit 0
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f "/etc/mwan3.user" ] && {
|
||||
. /lib/functions.sh
|
||||
|
||||
config_load mwan3
|
||||
config_get_bool enabled globals 'enabled' '0'
|
||||
[ ${enabled} -gt 0 ] || exit 0
|
||||
|
||||
config_get enabled "$INTERFACE" enabled 0
|
||||
[ "${enabled}" = "1" ] || exit 0
|
||||
env -i ACTION="$ACTION" INTERFACE="$INTERFACE" DEVICE="$DEVICE" \
|
||||
/bin/sh /etc/mwan3.user
|
||||
}
|
||||
|
||||
exit 0
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=19
|
||||
USE_PROCD=1
|
||||
|
||||
boot() {
|
||||
. /lib/config/uci.sh
|
||||
uci_toggle_state mwan3 globals enabled "1"
|
||||
mwan3_boot=1
|
||||
rc_procd start_service
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
/usr/sbin/mwan3 restart
|
||||
}
|
||||
|
||||
start_service() {
|
||||
[ -n "${mwan3_boot}" ] && return 0
|
||||
/usr/sbin/mwan3 start
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
/usr/sbin/mwan3 stop
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger 'mwan3'
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This file is interpreted as shell script.
|
||||
# Put your custom mwan3 action here, they will
|
||||
# be executed with each netifd hotplug interface event
|
||||
# on interfaces for which mwan3 is enabled.
|
||||
#
|
||||
# There are three main environment variables that are passed to this script.
|
||||
#
|
||||
# $ACTION
|
||||
# <ifup> Is called by netifd and mwan3track
|
||||
# <ifdown> Is called by netifd and mwan3track
|
||||
# <connected> Is only called by mwan3track if tracking was successful
|
||||
# <disconnected> Is only called by mwan3track if tracking has failed
|
||||
# $INTERFACE Name of the interface which went up or down (e.g. "wan" or "wwan")
|
||||
# $DEVICE Physical device name which interface went up or down (e.g. "eth0" or "wwan0")
|
@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
mwan3_migrate_flush_conntrack() {
|
||||
local iface="$1"
|
||||
|
||||
config_get value "${iface}" flush_conntrack
|
||||
case $value in
|
||||
always)
|
||||
uci_remove mwan3 "$iface" flush_conntrack
|
||||
uci_add_list mwan3 "$iface" flush_conntrack ifup
|
||||
uci_add_list mwan3 "$iface" flush_conntrack ifdown
|
||||
;;
|
||||
never)
|
||||
uci_remove mwan3 "$iface" flush_conntrack
|
||||
;;
|
||||
esac
|
||||
|
||||
uci_commit mwan3
|
||||
}
|
||||
|
||||
config_load mwan3
|
||||
config_foreach mwan3_migrate_flush_conntrack interface
|
||||
|
||||
exit 0
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
get_uptime() {
|
||||
local uptime=$(cat /proc/uptime)
|
||||
echo "${uptime%%.*}"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,230 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/mwan3/common.sh
|
||||
|
||||
MWAN3TRACK_STATUS_DIR="/var/run/mwan3track"
|
||||
|
||||
IPS="ipset"
|
||||
IPT4="iptables -t mangle -w"
|
||||
IPT6="ip6tables -t mangle -w"
|
||||
|
||||
report_connected_v4() {
|
||||
local address
|
||||
|
||||
if [ -n "$($IPT4 -S mwan3_connected 2> /dev/null)" ]; then
|
||||
for address in $($IPS -o save list mwan3_connected_v4 | grep add | cut -d " " -f 3); do
|
||||
json_add_string "" "${address}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
report_connected_v6() {
|
||||
local address
|
||||
|
||||
if [ -n "$($IPT6 -S mwan3_connected 2> /dev/null)" ]; then
|
||||
for address in $($IPS -o save list mwan3_connected_v6 | grep add | cut -d " " -f 3); do
|
||||
json_add_string "" "${address}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
report_policies() {
|
||||
local ipt="$1"
|
||||
local policy="$2"
|
||||
|
||||
local percent total_weight weight iface
|
||||
|
||||
total_weight=$($ipt -S $policy | grep -v '.*--comment "out .*" .*$' | cut -s -d'"' -f2 | head -1 | awk '{print $3}')
|
||||
|
||||
for iface in $($ipt -S $policy | grep -v '.*--comment "out .*" .*$' | cut -s -d'"' -f2 | awk '{print $1}'); do
|
||||
weight=$($ipt -S $policy | grep -v '.*--comment "out .*" .*$' | cut -s -d'"' -f2 | awk '$1 == "'$iface'"' | awk '{print $2}')
|
||||
percent=$(($weight*100/$total_weight))
|
||||
json_add_object
|
||||
json_add_string interface "$iface"
|
||||
json_add_int percent "$percent"
|
||||
json_close_object
|
||||
done
|
||||
}
|
||||
|
||||
report_policies_v4() {
|
||||
local policy
|
||||
|
||||
for policy in $($IPT4 -S | awk '{print $2}' | grep mwan3_policy_ | sort -u); do
|
||||
json_add_array "${policy##*mwan3_policy_}"
|
||||
report_policies "$IPT4" "$policy"
|
||||
json_close_array
|
||||
done
|
||||
}
|
||||
|
||||
report_policies_v6() {
|
||||
local policy
|
||||
|
||||
for policy in $($IPT6 -S | awk '{print $2}' | grep mwan3_policy_ | sort -u); do
|
||||
json_add_array "${policy##*mwan3_policy_}"
|
||||
report_policies "$IPT6" "$policy"
|
||||
json_close_array
|
||||
done
|
||||
}
|
||||
|
||||
get_mwan3_status() {
|
||||
local iface="${1}"
|
||||
local iface_select="${2}"
|
||||
local running="0"
|
||||
local age=0
|
||||
local online=0
|
||||
local offline=0
|
||||
local up="0"
|
||||
local enabled pid device time_p time_n time_u time_d status
|
||||
|
||||
network_get_device device $1
|
||||
|
||||
if [ "${iface}" = "${iface_select}" ] || [ "${iface_select}" = "" ]; then
|
||||
pid="$(pgrep -f "mwan3track $iface $device")"
|
||||
if [ "${pid}" != "" ]; then
|
||||
running="1"
|
||||
fi
|
||||
|
||||
time_p="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TIME")"
|
||||
[ -z "${time_p}" ] || {
|
||||
time_n="$(get_uptime)"
|
||||
let age=time_n-time_p
|
||||
}
|
||||
|
||||
time_u="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/ONLINE")"
|
||||
[ -z "${time_u}" ] || [ "${time_u}" = "0" ] || {
|
||||
time_n="$(get_uptime)"
|
||||
let online=time_n-time_u
|
||||
}
|
||||
|
||||
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/OFFLINE")"
|
||||
[ -z "${time_d}" ] || [ "${time_d}" = "0" ] || {
|
||||
time_n="$(get_uptime)"
|
||||
let offline=time_n-time_d
|
||||
}
|
||||
|
||||
local uptime="0"
|
||||
|
||||
config_get enabled "$iface" enabled 0
|
||||
network_get_uptime uptime "$iface"
|
||||
network_is_up "$iface" && up="1"
|
||||
|
||||
if [ -f "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS" ]; then
|
||||
status="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/STATUS")"
|
||||
else
|
||||
status="unknown"
|
||||
fi
|
||||
|
||||
json_add_object "${iface}"
|
||||
json_add_int age "$age"
|
||||
json_add_int online "${online}"
|
||||
json_add_int offline "${offline}"
|
||||
json_add_int uptime "${uptime}"
|
||||
json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")"
|
||||
json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")"
|
||||
json_add_int "turn" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TURN")"
|
||||
json_add_string "status" "${status}"
|
||||
json_add_boolean "enabled" "${enabled}"
|
||||
json_add_boolean "running" "${running}"
|
||||
json_add_boolean "up" "${up}"
|
||||
json_add_array "track_ip"
|
||||
for file in $MWAN3TRACK_STATUS_DIR/${iface}/*; do
|
||||
track="${file#*/TRACK_}"
|
||||
if [ "${track}" != "${file}" ]; then
|
||||
json_add_object
|
||||
json_add_string ip "${track}"
|
||||
json_add_string status "$(cat "${file}")"
|
||||
json_add_int latency "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LATENCY_${track}")"
|
||||
json_add_int packetloss "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOSS_${track}")"
|
||||
json_close_object
|
||||
fi
|
||||
done
|
||||
json_close_array
|
||||
json_close_object
|
||||
fi
|
||||
}
|
||||
|
||||
main () {
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
json_init
|
||||
json_add_object "status"
|
||||
json_add_string "section" "x"
|
||||
json_add_string "interface" "x"
|
||||
json_add_string "policies" "x"
|
||||
json_close_object
|
||||
json_dump
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
status)
|
||||
local section iface
|
||||
read input;
|
||||
json_load "$input"
|
||||
json_get_var section section
|
||||
json_get_var iface interface
|
||||
|
||||
config_load mwan3
|
||||
json_init
|
||||
case "$section" in
|
||||
interfaces)
|
||||
json_add_object interfaces
|
||||
config_foreach get_mwan3_status interface "${iface}"
|
||||
json_close_object
|
||||
;;
|
||||
connected)
|
||||
json_add_object connected
|
||||
json_add_array ipv4
|
||||
report_connected_v4
|
||||
json_close_array
|
||||
json_add_array ipv6
|
||||
report_connected_v6
|
||||
json_close_array
|
||||
json_close_object
|
||||
;;
|
||||
policies)
|
||||
json_add_object policies
|
||||
json_add_object ipv4
|
||||
report_policies_v4
|
||||
json_close_object
|
||||
json_add_object ipv6
|
||||
report_policies_v6
|
||||
json_close_object
|
||||
json_close_object
|
||||
;;
|
||||
*)
|
||||
# interfaces
|
||||
json_add_object interfaces
|
||||
config_foreach get_mwan3_status interface
|
||||
json_close_object
|
||||
# connected
|
||||
json_add_object connected
|
||||
json_add_array ipv4
|
||||
report_connected_v4
|
||||
json_close_array
|
||||
json_add_array ipv6
|
||||
report_connected_v6
|
||||
json_close_array
|
||||
json_close_object
|
||||
# policies
|
||||
json_add_object policies
|
||||
json_add_object ipv4
|
||||
report_policies_v4
|
||||
json_close_object
|
||||
json_add_object ipv6
|
||||
report_policies_v6
|
||||
json_close_object
|
||||
json_close_object
|
||||
;;
|
||||
esac
|
||||
json_dump
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,213 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions/network.sh
|
||||
. /lib/mwan3/mwan3.sh
|
||||
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
Syntax: mwan3 [command]
|
||||
|
||||
Available commands:
|
||||
start Load iptables rules, ip rules and ip routes
|
||||
stop Unload iptables rules, ip rules and ip routes
|
||||
restart Reload iptables rules, ip rules and ip routes
|
||||
ifup <iface> Load rules and routes for specific interface
|
||||
ifdown <iface> Unload rules and routes for specific interface
|
||||
interfaces Show interfaces status
|
||||
policies Show currently active policy
|
||||
connected Show directly connected networks
|
||||
rules Show active rules
|
||||
status Show all status
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
ifdown()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: Expecting interface. Usage: mwan3 ifdown <interface>" && exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
echo "Error: Too many arguments. Usage: mwan3 ifdown <interface>" && exit 0
|
||||
fi
|
||||
|
||||
ACTION=ifdown INTERFACE=$1 /sbin/hotplug-call iface
|
||||
|
||||
kill $(pgrep -f "mwan3track $1 $2") &> /dev/null
|
||||
mwan3_track_clean $1
|
||||
}
|
||||
|
||||
ifup()
|
||||
{
|
||||
local device enabled up l3_device status
|
||||
|
||||
config_load mwan3
|
||||
config_get_bool enabled globals 'enabled' 0
|
||||
[ ${enabled} -gt 0 ] || {
|
||||
echo "The service mwan3 is global disabled."
|
||||
echo "Please execute \"/etc/init.d/mwan3 start\" first."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Expecting interface. Usage: mwan3 ifup <interface>" && exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
echo "Too many arguments. Usage: mwan3 ifup <interface>" && exit 0
|
||||
fi
|
||||
|
||||
status=$(ubus -S call network.interface.$1 status)
|
||||
[ -n "$status" ] && {
|
||||
json_load "$status"
|
||||
json_get_vars up l3_device
|
||||
}
|
||||
|
||||
config_get enabled "$1" enabled 0
|
||||
|
||||
if [ "$up" = "1" ] \
|
||||
&& [ -n "$l3_device" ] \
|
||||
&& [ "$enabled" = "1" ]; then
|
||||
ACTION=ifup INTERFACE=$1 DEVICE=$l3_device /sbin/hotplug-call iface
|
||||
fi
|
||||
}
|
||||
|
||||
interfaces()
|
||||
{
|
||||
config_load mwan3
|
||||
|
||||
echo "Interface status:"
|
||||
config_foreach mwan3_report_iface_status interface
|
||||
echo -e
|
||||
}
|
||||
|
||||
policies()
|
||||
{
|
||||
echo "Current ipv4 policies:"
|
||||
mwan3_report_policies_v4
|
||||
echo -e
|
||||
echo "Current ipv6 policies:"
|
||||
mwan3_report_policies_v6
|
||||
echo -e
|
||||
}
|
||||
|
||||
connected()
|
||||
{
|
||||
echo "Directly connected ipv4 networks:"
|
||||
mwan3_report_connected_v4
|
||||
echo -e
|
||||
echo "Directly connected ipv6 networks:"
|
||||
mwan3_report_connected_v6
|
||||
echo -e
|
||||
}
|
||||
|
||||
rules()
|
||||
{
|
||||
echo "Active ipv4 user rules:"
|
||||
mwan3_report_rules_v4
|
||||
echo -e
|
||||
echo "Active ipv6 user rules:"
|
||||
mwan3_report_rules_v6
|
||||
echo -e
|
||||
}
|
||||
|
||||
status()
|
||||
{
|
||||
interfaces
|
||||
policies
|
||||
connected
|
||||
rules
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
local enabled
|
||||
|
||||
uci_toggle_state mwan3 globals enabled "1"
|
||||
|
||||
config_load mwan3
|
||||
config_foreach ifup interface
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
local ipset route rule table IP IPT pid
|
||||
|
||||
mwan3_lock "command" "mwan3"
|
||||
|
||||
for pid in $(pgrep -f "mwan3rtmon"); do
|
||||
kill -TERM "$pid" > /dev/null 2>&1
|
||||
sleep 1
|
||||
kill -KILL "$pid" > /dev/null 2>&1
|
||||
done
|
||||
|
||||
for pid in $(pgrep -f "mwan3track"); do
|
||||
kill -TERM "$pid" > /dev/null 2>&1
|
||||
sleep 1
|
||||
kill -KILL "$pid" > /dev/null 2>&1
|
||||
done
|
||||
|
||||
config_load mwan3
|
||||
config_foreach mwan3_track_clean interface
|
||||
|
||||
for IP in "$IP4" "$IP6"; do
|
||||
|
||||
for route in $(seq 1 $MWAN3_INTERFACE_MAX); do
|
||||
$IP route flush table $route &> /dev/null
|
||||
done
|
||||
|
||||
for rule in $($IP rule list | egrep '^[1-2][0-9]{3}\:' | cut -d ':' -f 1); do
|
||||
$IP rule del pref $rule &> /dev/null
|
||||
done
|
||||
done
|
||||
|
||||
for IPT in "$IPT4" "$IPT6"; do
|
||||
|
||||
$IPT -D PREROUTING -j mwan3_hook &> /dev/null
|
||||
$IPT -D OUTPUT -j mwan3_hook &> /dev/null
|
||||
|
||||
for table in $($IPT -S | awk '{print $2}' | grep mwan3 | sort -u); do
|
||||
$IPT -F $table &> /dev/null
|
||||
done
|
||||
|
||||
for table in $($IPT -S | awk '{print $2}' | grep mwan3 | sort -u); do
|
||||
$IPT -X $table &> /dev/null
|
||||
done
|
||||
done
|
||||
|
||||
for ipset in $($IPS -n list | grep mwan3_); do
|
||||
$IPS -q destroy $ipset
|
||||
done
|
||||
|
||||
for ipset in $($IPS -n list | grep mwan3 | grep -E '_v4|_v6'); do
|
||||
$IPS -q destroy $ipset
|
||||
done
|
||||
|
||||
mwan3_unlock "command" "mwan3"
|
||||
|
||||
mwan3_lock_clean
|
||||
rm -rf $MWAN3_STATUS_DIR $MWAN3TRACK_STATUS_DIR
|
||||
|
||||
uci_toggle_state mwan3 globals enabled "0"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart)
|
||||
mwan3_init
|
||||
$*
|
||||
;;
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/mwan3/mwan3.sh
|
||||
|
||||
LOG="logger -t $(basename "$0")[$$] -p"
|
||||
|
||||
clean_up() {
|
||||
$LOG notice "Stopping mwan3rtmon..."
|
||||
exit 0
|
||||
}
|
||||
|
||||
rtchange() {
|
||||
$LOG info "Detect rtchange event."
|
||||
}
|
||||
|
||||
main() {
|
||||
local rtmon_interval
|
||||
trap clean_up TERM
|
||||
trap rtchange USR1
|
||||
|
||||
config_load mwan3
|
||||
config_get rtmon_interval globals rtmon_interval '5'
|
||||
|
||||
sleep 3
|
||||
while true; do
|
||||
mwan3_lock "service" "mwan3rtmon"
|
||||
mwan3_rtmon_ipv4 || mwan3_rtmon_ipv6
|
||||
ret=$?
|
||||
mwan3_unlock "service" "mwan3rtmon"
|
||||
[ "$ret" = "0" ] || break
|
||||
[ "$rtmon_interval" = "0" ] && break
|
||||
sleep "$rtmon_interval" &
|
||||
wait
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,293 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/mwan3/common.sh
|
||||
|
||||
LOG="logger -t $(basename "$0")[$$] -p"
|
||||
INTERFACE=""
|
||||
DEVICE=""
|
||||
PING="/bin/ping"
|
||||
|
||||
IFDOWN_EVENT=0
|
||||
|
||||
clean_up() {
|
||||
$LOG notice "Stopping mwan3track for interface \"${INTERFACE}\""
|
||||
exit 0
|
||||
}
|
||||
|
||||
if_down() {
|
||||
$LOG info "Detect ifdown event on interface ${INTERFACE} (${DEVICE})"
|
||||
IFDOWN_EVENT=1
|
||||
}
|
||||
|
||||
validate_track_method() {
|
||||
case "$1" in
|
||||
ping)
|
||||
which ping 1>/dev/null 2>&1 || {
|
||||
$LOG warn "Missing ping. Please install iputils-ping package or enable ping util and recompile busybox."
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
arping)
|
||||
which arping 1>/dev/null 2>&1 || {
|
||||
$LOG warn "Missing arping. Please install iputils-arping package."
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
httping)
|
||||
which httping 1>/dev/null 2>&1 || {
|
||||
$LOG warn "Missing httping. Please install httping package."
|
||||
return 1
|
||||
}
|
||||
[ -n "$2" -a "$2" != "0.0.0.0" -a "$2" != "::" ] || {
|
||||
$LOG warn "Cannot determine source IP for the interface which is required by httping."
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
nping-*)
|
||||
which nping 1>/dev/null 2>&1 || {
|
||||
$LOG warn "Missing nping. Please install nping package."
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
*)
|
||||
$LOG warn "Unsupported tracking method: $track_method"
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main() {
|
||||
local reliability count timeout interval failure_interval
|
||||
local recovery_interval down up size
|
||||
local keep_failure_interval check_quality failure_latency
|
||||
local recovery_latency failure_loss recovery_loss
|
||||
local max_ttl httping_ssl
|
||||
|
||||
[ -z "$5" ] && echo "Error: should not be started manually" && exit 0
|
||||
|
||||
INTERFACE=$1
|
||||
DEVICE=$2
|
||||
STATUS=$3
|
||||
SRC_IP=$4
|
||||
mkdir -p /var/run/mwan3track/$1
|
||||
trap clean_up TERM
|
||||
trap if_down USR1
|
||||
|
||||
config_load mwan3
|
||||
config_get track_method $1 track_method ping
|
||||
config_get_bool httping_ssl $1 httping_ssl 0
|
||||
validate_track_method $track_method $SRC_IP || {
|
||||
track_method=ping
|
||||
if validate_track_method $track_method; then
|
||||
$LOG warn "Using ping to track interface $INTERFACE avaliability"
|
||||
else
|
||||
$LOG err "No track method avaliable"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
config_get reliability $1 reliability 1
|
||||
config_get count $1 count 1
|
||||
config_get timeout $1 timeout 4
|
||||
config_get interval $1 interval 10
|
||||
config_get down $1 down 5
|
||||
config_get up $1 up 5
|
||||
config_get size $1 size 56
|
||||
config_get max_ttl $1 max_ttl 60
|
||||
config_get failure_interval $1 failure_interval $interval
|
||||
config_get_bool keep_failure_interval $1 keep_failure_interval 0
|
||||
config_get recovery_interval $1 recovery_interval $interval
|
||||
config_get_bool check_quality $1 check_quality 0
|
||||
config_get failure_latency $1 failure_latency 1000
|
||||
config_get recovery_latency $1 recovery_latency 500
|
||||
config_get failure_loss $1 failure_loss 40
|
||||
config_get recovery_loss $1 recovery_loss 10
|
||||
|
||||
local score=$(($down+$up))
|
||||
local track_ips=$(echo $* | cut -d ' ' -f 5-99)
|
||||
local host_up_count=0
|
||||
local lost=0
|
||||
local sleep_time=0
|
||||
local turn=0
|
||||
local result
|
||||
local ping_protocol=4
|
||||
local ping_result
|
||||
local ping_result_raw
|
||||
local ping_status
|
||||
local loss=0
|
||||
local latency=0
|
||||
|
||||
if [ "$STATUS" = "offline" ]; then
|
||||
echo "offline" > /var/run/mwan3track/$1/STATUS
|
||||
echo "0" > /var/run/mwan3track/$1/ONLINE
|
||||
echo "$(get_uptime)" > /var/run/mwan3track/$1/OFFLINE
|
||||
score=0
|
||||
else
|
||||
echo "online" > /var/run/mwan3track/$1/STATUS
|
||||
echo "0" > /var/run/mwan3track/$1/OFFLINE
|
||||
echo "$(get_uptime)" > /var/run/mwan3track/$1/ONLINE
|
||||
env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
|
||||
fi
|
||||
while true; do
|
||||
|
||||
sleep_time=$interval
|
||||
|
||||
for track_ip in $track_ips; do
|
||||
if [ $host_up_count -lt $reliability ]; then
|
||||
case "$track_method" in
|
||||
ping)
|
||||
# pinging IPv6 hosts with an interface is troublesome
|
||||
# https://bugs.openwrt.org/index.php?do=details&task_id=2897
|
||||
# so get the IP address of the interface and use that instead
|
||||
if echo $track_ip | grep -q ':'; then
|
||||
ADDR=$(ip -6 addr ls dev "$DEVICE" | sed -ne '/\/128/d' -e 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p' | head -n1)
|
||||
[ -z "$ADDR" ] && ADDR=$(ip -6 addr ls dev "$DEVICE" | sed -ne 's/ *inet6 \([^ \/]*\).* scope global.*/\1/p')
|
||||
ping_protocol=6
|
||||
fi
|
||||
if [ $check_quality -eq 0 ]; then
|
||||
$PING -$ping_protocol -I ${ADDR:-$DEVICE} -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null
|
||||
result=$?
|
||||
else
|
||||
ping_result_raw="$($PING -$ping_protocol -I ${ADDR:-$DEVICE} -c $count -W $timeout -s $size -t $max_ttl -q $track_ip 2>/dev/null)"
|
||||
ping_status=$?
|
||||
ping_result=$(echo "$ping_result_raw" | tail -n2)
|
||||
loss="$(echo "$ping_result" | grep "packet loss" | cut -d "," -f3 | awk '{print $1}' | sed -e 's/%//')"
|
||||
if [ "$ping_status" -ne 0 ] || [ "$loss" -eq 100 ]; then
|
||||
latency=999999
|
||||
loss=100
|
||||
else
|
||||
latency="$(echo "$ping_result" | grep -E 'rtt|round-trip' | cut -d "=" -f2 | cut -d "/" -f2 | cut -d "." -f1)"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
arping)
|
||||
arping -I $DEVICE -c $count -w $timeout -q $track_ip &> /dev/null
|
||||
result=$?
|
||||
;;
|
||||
httping)
|
||||
if [ "$httping_ssl" -eq 1 ]; then
|
||||
httping -y $SRC_IP -c $count -t $timeout -q "https://$track_ip" &> /dev/null
|
||||
else
|
||||
httping -y $SRC_IP -c $count -t $timeout -q "http://$track_ip" &> /dev/null
|
||||
fi
|
||||
result=$?
|
||||
;;
|
||||
nping-tcp)
|
||||
result=$(nping -e $DEVICE -c $count $track_ip --tcp | grep Lost | awk '{print $12}')
|
||||
;;
|
||||
nping-udp)
|
||||
result=$(nping -e $DEVICE -c $count $track_ip --udp | grep Lost | awk '{print $12}')
|
||||
;;
|
||||
nping-icmp)
|
||||
result=$(nping -e $DEVICE -c $count $track_ip --icmp | grep Lost | awk '{print $12}')
|
||||
;;
|
||||
nping-arp)
|
||||
result=$(nping -e $DEVICE -c $count $track_ip --arp | grep Lost | awk '{print $12}')
|
||||
;;
|
||||
esac
|
||||
if [ $check_quality -eq 0 ]; then
|
||||
if [ $result -eq 0 ]; then
|
||||
let host_up_count++
|
||||
echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip}
|
||||
if [ $score -le $up ]; then
|
||||
$LOG info "Check ($track_method) success for target \"$track_ip\" on interface $1 ($2)"
|
||||
fi
|
||||
else
|
||||
let lost++
|
||||
echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip}
|
||||
if [ $score -gt $up ]; then
|
||||
$LOG info "Check ($track_method) failed for target \"$track_ip\" on interface $1 ($2)"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "$loss" -ge "$failure_loss" -o "$latency" -ge "$failure_latency" ]; then
|
||||
let lost++
|
||||
echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip}
|
||||
echo "$latency" > /var/run/mwan3track/$1/LATENCY_${track_ip}
|
||||
echo "$loss" > /var/run/mwan3track/$1/LOSS_${track_ip}
|
||||
|
||||
if [ $score -gt $up ]; then
|
||||
$LOG info "Check (${track_method}: latency=${latency}ms loss=${loss}%) failed for target \"$track_ip\" on interface $1 ($2)"
|
||||
fi
|
||||
elif [ "$loss" -le "$recovery_loss" -a "$latency" -le "$recovery_latency" ]; then
|
||||
let host_up_count++
|
||||
echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip}
|
||||
echo "$latency" > /var/run/mwan3track/$1/LATENCY_${track_ip}
|
||||
echo "$loss" > /var/run/mwan3track/$1/LOSS_${track_ip}
|
||||
|
||||
if [ $score -le $up ]; then
|
||||
$LOG info "Check (${track_method}: latency=${latency}ms loss=${loss}%) success for target \"$track_ip\" on interface $1 ($2)"
|
||||
fi
|
||||
else
|
||||
echo "skipped" > /var/run/mwan3track/$1/TRACK_${track_ip}
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "skipped" > /var/run/mwan3track/$1/TRACK_${track_ip}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $host_up_count -lt $reliability ]; then
|
||||
let score--
|
||||
|
||||
if [ $score -lt $up ]; then
|
||||
score=0
|
||||
[ ${keep_failure_interval} -eq 1 ] && {
|
||||
sleep_time=$failure_interval
|
||||
}
|
||||
else
|
||||
sleep_time=$failure_interval
|
||||
fi
|
||||
|
||||
if [ $score -eq $up ]; then
|
||||
echo "offline" > /var/run/mwan3track/$1/STATUS
|
||||
env -i ACTION=ifdown INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface
|
||||
score=0
|
||||
fi
|
||||
else
|
||||
if [ $score -lt $(($down+$up)) ] && [ $lost -gt 0 ]; then
|
||||
$LOG info "Lost $(($lost*$count)) ping(s) on interface $1 ($2)"
|
||||
fi
|
||||
|
||||
let score++
|
||||
lost=0
|
||||
|
||||
if [ $score -gt $up ]; then
|
||||
echo "online" > /var/run/mwan3track/$1/STATUS
|
||||
score=$(($down+$up))
|
||||
elif [ $score -le $up ]; then
|
||||
sleep_time=$recovery_interval
|
||||
fi
|
||||
|
||||
if [ $score -eq $up ]; then
|
||||
$LOG notice "Interface $1 ($2) is online"
|
||||
echo "online" > /var/run/mwan3track/$1/STATUS
|
||||
env -i ACTION=ifup INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
let turn++
|
||||
mkdir -p "/var/run/mwan3track/${1}"
|
||||
echo "${lost}" > /var/run/mwan3track/$1/LOST
|
||||
echo "${score}" > /var/run/mwan3track/$1/SCORE
|
||||
echo "${turn}" > /var/run/mwan3track/$1/TURN
|
||||
echo "$(get_uptime)" > /var/run/mwan3track/$1/TIME
|
||||
|
||||
host_up_count=0
|
||||
sleep "${sleep_time}" &
|
||||
wait
|
||||
|
||||
if [ "${IFDOWN_EVENT}" -eq 1 ]; then
|
||||
echo "offline" > /var/run/mwan3track/$1/STATUS
|
||||
echo "$(get_uptime)" > /var/run/mwan3track/$1/OFFLINE
|
||||
echo "0" > /var/run/mwan3track/$1/ONLINE
|
||||
$LOG notice "Interface $1 ($2) is offline"
|
||||
env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
|
||||
score=0
|
||||
IFDOWN_EVENT=0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,95 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2017-2020
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=qbittorrent
|
||||
PKG_VERSION:=4.4.5
|
||||
PKG_RELEASE=1
|
||||
|
||||
PKG_SOURCE:=qBittorrent-release-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/qbittorrent/qBittorrent/tar.gz/release-$(PKG_VERSION)?
|
||||
PKG_HASH:=70c2128b44fe4df4dfc8afc765a304d70cf1b042b5214bcc855d8b3bbc9ccf36
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/qBittorrent-release-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:qbittorrent:qbittorrent
|
||||
|
||||
PKG_BUILD_DEPENDS:=qttools
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/qbittorrent
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=BitTorrent
|
||||
DEPENDS:=+libgcc +libstdcpp \
|
||||
+rblibtorrent \
|
||||
+libopenssl \
|
||||
+qt5-core \
|
||||
+qt5-network \
|
||||
+qt5-sql \
|
||||
+qt5-xml \
|
||||
+zlib
|
||||
TITLE:=bittorrent client programmed in C++ / Qt
|
||||
URL:=https://www.qbittorrent.org/
|
||||
PROVIDES:=qBittorrent
|
||||
endef
|
||||
|
||||
define Package/qbittorrent/description
|
||||
qBittorrent is a bittorrent client programmed in C++ / Qt that uses
|
||||
libtorrent (sometimes called libtorrent-rasterbar) by Arvid Norberg.
|
||||
It aims to be a good alternative to all other bittorrent clients out
|
||||
there. qBittorrent is fast, stable and provides unicode support as
|
||||
well as many features.
|
||||
endef
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DQT6=OFF \
|
||||
-DSTACKTRACE=OFF \
|
||||
-DWEBUI=ON \
|
||||
-DGUI=OFF \
|
||||
-DVERBOSE_CONFIGURE=ON
|
||||
|
||||
# The pcre2 is compiled with support for mips16
|
||||
ifdef CONFIG_USE_MIPS16
|
||||
TARGET_CFLAGS += -minterlink-mips16
|
||||
endif
|
||||
|
||||
# Support the glibc
|
||||
ifdef CONFIG_USE_GLIBC
|
||||
TARGET_LDFLAGS += -ldl -lrt -lpthread
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -std=c++17 -ffunction-sections -fdata-sections -flto
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -flto
|
||||
|
||||
# The pentium-mmx with lto will build failed on qt6
|
||||
ifeq ($(ARCH),i386)
|
||||
ifneq ($(findstring pentium-mmx,$(CONFIG_CPU_TYPE)),)
|
||||
TARGET_CFLAGS := $(filter-out -flto,$(TARGET_CFLAGS))
|
||||
TARGET_LDFLAGS := $(filter-out -flto,$(TARGET_LDFLAGS))
|
||||
endif
|
||||
endif
|
||||
|
||||
define Package/qbittorrent/conffiles
|
||||
/etc/config/qbittorrent
|
||||
endef
|
||||
|
||||
define Package/qbittorrent/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qbittorrent-nox $(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,qbittorrent))
|
200
qtbase/Makefile
Normal file
200
qtbase/Makefile
Normal file
@ -0,0 +1,200 @@
|
||||
#
|
||||
# Copyright (C) 2020 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=qtbase
|
||||
PKG_BASE:=5.15
|
||||
PKG_BUGFIX:=6
|
||||
PKG_VERSION:=$(PKG_BASE).$(PKG_BUGFIX)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-everywhere-opensource-src-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:= \
|
||||
http://master.qt.io/archive/qt/$(PKG_BASE)/$(PKG_VERSION)/submodules \
|
||||
http://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/$(PKG_BASE)/$(PKG_VERSION)/submodules \
|
||||
http://qt.mirror.constant.com/archive/qt/$(PKG_BASE)/$(PKG_VERSION)/submodules
|
||||
PKG_HASH:=396bc6b0d773ac6a7c691a4c3d901999f571e3e7033d7fd6f65e4ef2b6eb7340
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-everywhere-src-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_CPE_ID:=cpe:/a:qt:qt
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/qtbase/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=Qt5
|
||||
TITLE:=qtbase
|
||||
URL:=http://qt-project.org
|
||||
DEPENDS:=+libgcc +libstdcpp @!LINUX_2_6_36
|
||||
endef
|
||||
|
||||
define Package/qtbase/description
|
||||
This package provides the Qt5 libraries.
|
||||
|
||||
Qt is a cross-platform application development framework for desktop, embedded and mobile.
|
||||
Supported Platforms include Linux, OS X, Windows, VxWorks, QNX, Android, iOS, BlackBerry,
|
||||
Sailfish OS and others.
|
||||
|
||||
Qt is not a programming language on its own. It is a framework written in C++.
|
||||
|
||||
This package provides the following run-time libraries:
|
||||
- core
|
||||
- network
|
||||
- xml
|
||||
endef
|
||||
|
||||
define Package/qtbase
|
||||
$(call Package/qtbase/Default)
|
||||
TITLE+=all libs
|
||||
DEPENDS+=$(QTBASE_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/qtbase/install
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/qtbase/config
|
||||
config QT5_INCLUDE_ATOMIC
|
||||
bool "Depends on libatomic"
|
||||
default y if !(arm_v7 || ARCH_64BIT || TARGET_x86)
|
||||
default n
|
||||
help
|
||||
Check this options to add the libatomic to the dependences.
|
||||
- You'd better to confirm whether your compiler need the external libatomic.
|
||||
Otherwise, it is not recommended to modify this option mannually.
|
||||
|
||||
menu "Select Qtbase Libraries"
|
||||
comment "Qtbase Libraries"
|
||||
|
||||
$(foreach lib,$(QTBASE_LIBS),
|
||||
config PACKAGE_qt5-$(lib)
|
||||
prompt "Qtbase $(lib) library."
|
||||
default m if ALL
|
||||
)
|
||||
endmenu
|
||||
endef
|
||||
|
||||
PKG_CONFIG_DEPENDS = CONFIG_QT5_INCLUDE_ATOMIC
|
||||
|
||||
EXTRA_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -flto
|
||||
EXTRA_LDFLAGS += -Wl,--gc-sections,--as-needed
|
||||
|
||||
CONFIGURE_ARGS = \
|
||||
-sysroot $(STAGING_DIR) \
|
||||
-hostprefix $(STAGING_DIR_HOSTPKG) \
|
||||
-extprefix $(STAGING_DIR)/usr \
|
||||
-prefix /usr \
|
||||
-archdatadir /usr/share/Qt \
|
||||
-datadir /usr/share/Qt \
|
||||
-device linux-generic-g++ \
|
||||
-device-option CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
-device-option COMPILER_FLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
|
||||
-device-option LINKER_FLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
|
||||
-confirm-license \
|
||||
-opensource \
|
||||
-release \
|
||||
-shared \
|
||||
-strip \
|
||||
-no-rpath \
|
||||
-no-use-gold-linker \
|
||||
-ltcg \
|
||||
-mimetype-database \
|
||||
-openssl-linked \
|
||||
-qt-doubleconversion \
|
||||
-system-pcre \
|
||||
-system-zlib \
|
||||
$(if $(findstring i386,$(ARCH)),-no-sse2 -no-sse4.1) \
|
||||
-no-angle \
|
||||
-no-cups \
|
||||
-no-dbus \
|
||||
-no-directfb \
|
||||
-no-dtls\
|
||||
-no-egl \
|
||||
-no-eglfs \
|
||||
-no-freetype \
|
||||
-no-gbm \
|
||||
-no-glib \
|
||||
-no-gtk \
|
||||
-no-gui \
|
||||
-no-harfbuzz \
|
||||
-no-iconv \
|
||||
-no-icu \
|
||||
-no-kms \
|
||||
-no-libjpeg \
|
||||
-no-libmd4c \
|
||||
-no-libpng \
|
||||
-no-libudev \
|
||||
-no-mtdev \
|
||||
-no-opengl \
|
||||
-no-opengles3 \
|
||||
-no-openvg \
|
||||
-no-pch \
|
||||
-no-slog2 \
|
||||
-sql-sqlite \
|
||||
-no-trace \
|
||||
-no-tslib \
|
||||
-no-vulkan \
|
||||
-no-widgets \
|
||||
-no-xcb \
|
||||
-no-xkbcommon \
|
||||
-no-zstd \
|
||||
-no-compile-examples \
|
||||
-no-feature-concurrent \
|
||||
-no-feature-gssapi \
|
||||
-no-feature-testlib \
|
||||
-make libs \
|
||||
-nomake examples \
|
||||
-nomake tests \
|
||||
-nomake tools \
|
||||
-v
|
||||
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) install
|
||||
endef
|
||||
|
||||
define Package/qtbase/Default/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/libQt5$(shell echo $(2) | sed -e 's/\b[[:alpha:]]/\u&/g').so* $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define DefineQtbaseLibrary
|
||||
QTBASE_DEPENDS+=+qt5-$(1)
|
||||
|
||||
QTBASE_LIBS+=$(1)
|
||||
|
||||
define Package/qt5-$(1)
|
||||
$(call Package/qtbase/Default)
|
||||
TITLE+=$(1)
|
||||
DEPENDS+=$(foreach lib,$(2),+qt5-$(lib)) $(3)
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
define Package/qt5-$(1)/description
|
||||
This package contains the qt5 $(1) library.
|
||||
endef
|
||||
|
||||
define Package/qt5-$(1)/install
|
||||
$(call Package/qtbase/Default/install,$$(1),$(1))
|
||||
endef
|
||||
endef
|
||||
|
||||
$(eval $(call DefineQtbaseLibrary,core,,+QT5_INCLUDE_ATOMIC:libatomic +libpcre2-16 +zlib))
|
||||
$(eval $(call DefineQtbaseLibrary,network,core,+libopenssl +zlib))
|
||||
$(eval $(call DefineQtbaseLibrary,xml,core,))
|
||||
$(eval $(call DefineQtbaseLibrary,sql,core))
|
||||
|
||||
$(foreach lib,$(QTBASE_LIBS),$(eval $(call BuildPackage,qt5-$(lib))))
|
||||
$(eval $(call BuildPackage,qtbase))
|
50
qttools/Makefile
Normal file
50
qttools/Makefile
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# Copyright (C) 2019 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=qttools
|
||||
PKG_BASE:=5.15
|
||||
PKG_BUGFIX:=6
|
||||
PKG_VERSION:=$(PKG_BASE).$(PKG_BUGFIX)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-everywhere-opensource-src-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:= \
|
||||
http://master.qt.io/archive/qt/$(PKG_BASE)/$(PKG_VERSION)/submodules \
|
||||
http://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/$(PKG_BASE)/$(PKG_VERSION)/submodules \
|
||||
http://qt.mirror.constant.com/archive/qt/$(PKG_BASE)/$(PKG_VERSION)/submodules
|
||||
PKG_HASH:=2c1486ab7e6dad76fb34642cd4f91d533e5dfeec0ee527129c2c2ed4ab283c3b
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-everywhere-src-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=qtbase
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/qttools
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=Qt5
|
||||
TITLE:=qttools
|
||||
URL:=http://qt-project.org
|
||||
BUILDONLY:=1
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
cd $(PKG_BUILD_DIR) && qmake -o Makefile qttools.pro
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) install
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,qttools))
|
62
rblibtorrent/Makefile
Normal file
62
rblibtorrent/Makefile
Normal file
@ -0,0 +1,62 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rblibtorrent
|
||||
PKG_VERSION:=1.2.17
|
||||
PKG_RELEASE=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/arvidn/libtorrent.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=2d34455ad2b828d3da23634f7de93fafded5442d
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=3fa86163d370584f747d34737a556a5426fd5eb4ce1ba1dc594dce3357594d90
|
||||
|
||||
PKG_LICENSE:=BSD
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/rblibtorrent
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Rasterbar BitTorrent library
|
||||
URL:=https://www.libtorrent.org/
|
||||
DEPENDS:=+libgcc +libstdcpp +libopenssl +boost +boost-system +boost-chrono +boost-random +libatomic
|
||||
MAINTAINER:=Arvid Norberg <arvid@libtorrent.org>
|
||||
endef
|
||||
|
||||
define Package/rblibtorrent/description
|
||||
Rasterbar libtorrent is a C++ library that aims to be a good alternative to
|
||||
all the other bittorrent implementations around. It is a library and not a
|
||||
full featured client, although it comes with a working example client.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC -ffunction-sections -fdata-sections -flto
|
||||
EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++17)
|
||||
TARGET_LDFLAGS += -lstdc++ -Wl,--gc-sections,--as-needed -flto
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-Ddeprecated-functions=ON \
|
||||
-Dencryption=ON \
|
||||
-Diconv=ON \
|
||||
-Dstatic_runtime=ON \
|
||||
-Dlogging=OFF
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)
|
||||
$(CP) $(PKG_INSTALL_DIR)/* $(1)
|
||||
endef
|
||||
|
||||
define Package/rblibtorrent/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,rblibtorrent))
|
@ -1,58 +1,68 @@
|
||||
# SPDX-Identifier-License: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
PKG_ARCH_VERYSYNC:=amd64
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
PKG_ARCH_VERYSYNC:=mipsle
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
PKG_ARCH_VERYSYNC:=mips
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
PKG_ARCH_VERYSYNC:=386
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
PKG_ARCH_VERYSYNC:=arm
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_ARCH_VERYSYNC:=arm64
|
||||
PKG_HASH_VERYSYNC:=113b1098434c9657e51d95a86f70436ff55db291cca1094bc65e911642424367
|
||||
else ifeq ($(ARCH),arm)
|
||||
PKG_ARCH_VERYSYNC:=arm
|
||||
PKG_HASH_VERYSYNC:=6eb2a8e41dcdaacfecc20c13ef6b7805176dad6a410d38bf65a962bc0f7f8554
|
||||
else ifeq ($(ARCH),i386)
|
||||
PKG_ARCH_VERYSYNC:=386
|
||||
PKG_HASH_VERYSYNC:=d84b71cc7ef0db95bf0f6dc3d38884b3856cc36ae1ac1f430c35cdd033cc7c16
|
||||
else ifeq ($(ARCH),mips)
|
||||
PKG_ARCH_VERYSYNC:=mips
|
||||
PKG_HASH_VERYSYNC:=54d8fe303e3b51ae5078fe74e69ab64d102334e55ee257d9eec7aef13a21d911
|
||||
else ifeq ($(ARCH),mipsel)
|
||||
PKG_ARCH_VERYSYNC:=mipsle
|
||||
PKG_HASH_VERYSYNC:=7edc4eae4a1941d8a52fce2506d599af6f207498a3d8cabe819f023d0df15e2f
|
||||
else ifeq ($(ARCH),powerpc64)
|
||||
PKG_ARCH_VERYSYNC:=ppc64
|
||||
PKG_HASH_VERYSYNC:=c89e670b31123b240fc5e4be15cb7e836e8584b5a955efea5fca5b4f9d009ea1
|
||||
else ifeq ($(ARCH),x86_64)
|
||||
PKG_ARCH_VERYSYNC:=amd64
|
||||
PKG_HASH_VERYSYNC:=6214cd485bfc40a8c53a3c53e900a0fa2e629d5137345f3ad2195bd9e0f47fba
|
||||
PKG_ARCH_VERYSYNC:=arm64
|
||||
endif
|
||||
ifeq ($(ARCH),powerpc64)
|
||||
PKG_ARCH_VERYSYNC:=ppc64
|
||||
endif
|
||||
|
||||
PKG_NAME:=verysync
|
||||
PKG_VERSION:=2.14.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-linux-$(PKG_ARCH_VERYSYNC)-v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://dl.verysync.com/releases/v$(PKG_VERSION)/ \
|
||||
http://dl-cn.verysync.com/releases/v$(PKG_VERSION)/
|
||||
PKG_HASH:=$(PKG_HASH_VERYSYNC)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-linux-$(PKG_ARCH_VERYSYNC)-v$(PKG_VERSION)
|
||||
PKG_VERSION:=v2.13.2
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-linux-$(PKG_ARCH_VERYSYNC)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://dl.verysync.com/releases/$(PKG_VERSION)/
|
||||
PKG_HASH:=skip
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/verysync
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=A efficient data transmission tool
|
||||
URL:=http://www.verysync.com
|
||||
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||powerpc64||x86_64)
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=A efficient data transmission tool
|
||||
DEPENDS:=
|
||||
URL:=http://www.verysync.com
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Verysync is a efficient data transmission tool.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
tar -xzvf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/verysync/install
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/verysync $(1)/usr/bin/verysync
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME)-linux-$(PKG_ARCH_VERYSYNC)-$(PKG_VERSION)/verysync $(1)/usr/bin/verysync
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,verysync))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
Loading…
Reference in New Issue
Block a user