Merge Mainline

This commit is contained in:
AmadeusGhost 2020-05-30 21:26:11 +08:00
commit 72671ce4e7
29 changed files with 380 additions and 149 deletions

View File

@ -22,6 +22,8 @@
2012 率土之滨:[tcp;;10001;;;00:00|01:00,tcp;;8001;;;00:00|01:00]
2013 一刀传世:[tcp;;8040;;;00:47|01:45]
2014 第五人格:[tcp;;4010;;;,tcp;;4010;;;,tcp;;4020;;;,tcp;;4030;;;,tcp;;4040;;;,tcp;;4050;;;,tcp;;4060;;;,tcp;;4070;;;,tcp;;4080;;;,tcp;;4090;;;]
2016 皇室战争:[udp;;9339;;;]
2017 炉石传说:[tcp;;3724;;;00:73:01:00:02:00]
#class video
3001 抖音短视频:[tcp;;80;-dy-;;,tcp;;;-dy.;;]

View File

@ -9,7 +9,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=baidupcs-web
PKG_VERSION:=3.7.0
PKG_VERSION:=3.7.1
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
@ -18,8 +18,7 @@ define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
TITLE:=BaiduPCS-Web is a web controller for BaiduPCS-Go
URL:=https://github.com/liuzhuoling2011/baidupcs-web
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||x86_64)
URL:=https://github.com/Erope/baidupcs-web
endef
@ -47,7 +46,13 @@ ifeq ($(ARCH),mips)
endif
ifeq ($(ARCH),arm)
PKG_ARCH_BAIDUPCS-WEB:=arm
ifeq ($(BOARD),bcm53xx)
PKG_ARCH_BAIDUPCS-WEB:=armv5
else ifeq ($(BOARD),kirkwood)
PKG_ARCH_BAIDUPCS-WEB:=armv5
else
PKG_ARCH_BAIDUPCS-WEB:=armv7
endif
endif
ifeq ($(ARCH),aarch64)
@ -55,9 +60,9 @@ ifeq ($(ARCH),aarch64)
endif
PKG_SOURCE:=BaiduPCS-Go-$(PKG_VERSION)-linux-$(PKG_ARCH_BAIDUPCS-WEB).zip
PKG_SOURCE:=BaiduPCS-Go-v$(PKG_VERSION)-linux-$(PKG_ARCH_BAIDUPCS-WEB).zip
PKG_SOURCE_URL:=https://github.com/liuzhuoling2011/baidupcs-web/releases/download/$(PKG_VERSION)/
PKG_SOURCE_URL:=https://github.com/Erope/baidupcs-web/releases/download/$(PKG_VERSION)/
UNZIP_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/$(PKG_NAME)-unzip

View File

@ -51,7 +51,7 @@ echo "DISTRIB_DESCRIPTION='OpenWrt 18.06 by Lean '" >> /etc/openwrt_release
sed -i 's/LuCI openwrt-18.06 branch/LuCI 18.06 by Lean/g' /usr/lib/lua/luci/version.lua
sed -i '/luciversion/d' /usr/lib/lua/luci/version.lua
echo 'luciversion = "Mod20.04 by CTCGFW"' >> /usr/lib/lua/luci/version.lua
echo 'luciversion = "Mod20.05 by CTCGFW"' >> /usr/lib/lua/luci/version.lua
sed -i '/log-facility/d' /etc/dnsmasq.conf
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ipt2socks
PKG_VERSION:=1.0.2
PKG_RELEASE:=5
PKG_VERSION:=1.1.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/zfl9/ipt2socks.git
PKG_SOURCE_VERSION:=aebd43819d5eb63253c6df2610089188c194c3e3
PKG_SOURCE_VERSION:=cfbc2189356aba7fcafb0bc961a95419f313d8a7
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
@ -25,21 +25,12 @@ define Package/ipt2socks
CATEGORY:=Network
TITLE:=Utility for converting iptables (REDIRECT/TPROXY) to SOCKS5
URL:=https://github.com/zfl9/ipt2socks
DEPENDS:=+libuv
endef
define Package/ipt2socks/description
Utility for converting iptables (REDIRECT/TPROXY) to SOCKS5.
endef
define Package/ipt2socks/conffiles
/etc/config/ipt2socks
endef
#MAKE_FLAGS += INCLUDES="-I$(STAGING_DIR)/usr/include"
#MAKE_FLAGS += LDFLAGS="-L$(STAGING_DIR)/usr/lib"
MAKE_FLAGS += LIBS="-l:libuv_a.a"
define Package/ipt2socks/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ipt2socks $(1)/usr/bin

View File

@ -0,0 +1,49 @@
--- a/ipt2socks.c
+++ b/ipt2socks.c
@@ -28,6 +28,36 @@
#define IPT2SOCKS_VERSION "ipt2socks v1.1.2 <https://github.com/zfl9/ipt2socks>"
+#ifdef __MUSL__
+#include <unistd.h>
+#include <sys/syscall.h>
+
+ssize_t splice(int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len, unsigned int __flags) {
+#ifdef __NR_splice
+ return syscall(__NR_splice, __fdin, __offin, __fdout, __offout, __len, __flags);
+#else
+ (void)__fdin;
+ (void)__offin;
+ (void)__fdout;
+ (void)__offout;
+ (void)__len;
+ (void)__flags;
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#undef SPLICE_F_MOVE
+#undef SPLICE_F_NONBLOCK
+#undef SPLICE_F_MORE
+
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+
+#endif /* __MUSL__ */
+
enum {
OPT_ENABLE_TCP = 0x01 << 0, // enable tcp proxy
OPT_ENABLE_UDP = 0x01 << 1, // enable udp proxy
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -std=c99 -Wall -Wextra -O2 -pthread
+CFLAGS = -std=c99 -Wall -Wextra -O2 -pthread -D __MUSL__
LIBS = -lm
SRCS = ipt2socks.c logutils.c lrucache.c netutils.c protocol.c
OBJS = $(SRCS:.c=.o)

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=qos-scripts
PKG_VERSION:=1.3.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>

View File

@ -22,15 +22,20 @@ add_insmod() {
[ -e /etc/config/network ] && {
# only try to parse network config on openwrt
find_ifname() {(
reset_cb
include /lib/network
scan_interfaces
config_get "$1" ifname
)}
. /lib/functions/network.sh
find_ifname() {
local ifname
if network_get_device ifname "$1"; then
echo "$ifname"
else
echo "Device for interface $1 not found." >&2
exit 1
fi
}
} || {
find_ifname() {
echo "Interface not found."
echo "Interface not found." >&2
exit 1
}
}
@ -218,6 +223,7 @@ qos_parse_config() {
config_get device "$1" device
[ -z "$device" ] && {
device="$(find_ifname $1)"
[ -z "$device" ] && exit 1
config_set "$1" device "$device"
}
}

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-clash
PKG_VERSION:=1.6.9c
PKG_VERSION:=1.7.0
PKG_MAINTAINER:=frainzy1477
@ -101,6 +101,7 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/usr/share/
$(INSTALL_DIR) $(1)/usr/share/clash
$(INSTALL_DIR) $(1)/usr/share/clash/rules
$(INSTALL_DIR) $(1)/usr/share/clash/rules/g_rules
$(INSTALL_DIR) $(1)/usr/share/clash/dashboard
@ -124,7 +125,6 @@ define Package/$(PKG_NAME)/install
$(INSTALL_BIN) ./root/usr/share/clash/*.sh $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/dns.yaml $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/rules/g_rules/Steam.rules $(1)/usr/share/clash/rules/g_rules
$(INSTALL_BIN) ./root//usr/share/clash/rules/rules.list $(1)/usr/share/clash/rules
@ -137,6 +137,8 @@ define Package/$(PKG_NAME)/install
$(INSTALL_BIN) ./root/usr/share/clash/logstatus_check $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/clash.txt $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/index.html $(1)/usr/share/clash/dashboard/
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/main.1560b07adc97ac0ac265.css $(1)/usr/share/clash/dashboard/
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/img/ffac0fa1d89f15922b4594863b8b32e9.png $(1)/usr/share/clash/dashboard/img/

View File

@ -11,7 +11,10 @@ function index()
return
end
entry({"admin", "services", "clash"},alias("admin", "services", "clash", "overview"), _("Clash"), 5)
local page = entry({"admin", "services", "clash"},alias("admin", "services", "clash", "overview"), _("Clash"), 5)
page.dependent = true
page.acl_depends = { "luci-app-oclash" }
entry({"admin", "services", "clash", "overview"},cbi("clash/overview"),_("Overview"), 10).leaf = true
entry({"admin", "services", "clash", "client"},cbi("clash/client"),_("Client"), 20).leaf = true
@ -69,7 +72,6 @@ local function uhttp_port()
end
end
local function download_rule()
local filename = luci.http.formvalue("filename")
local rule_file_dir="/usr/share/clash/rules/g_rules/" .. filename
@ -89,7 +91,7 @@ function action_update_rule()
end
function action_update()
luci.sys.exec("kill $(pgrep /usr/share/clash/update.sh) ; (bash /usr/share/clash/update.sh >>/usr/share/clash/clash.txt 2>&1) &")
luci.sys.exec("kill $(pgrep /usr/share/clash/update.sh) ; (bash /usr/share/clash/update.sh >/usr/share/clash/clash.txt 2>&1) &")
end
@ -317,7 +319,6 @@ function action_status()
web = is_web(),
clash = is_running(),
localip = localip(),
uhttp_port = uhttp_port(),
dash_port = dash_port(),
current_version = current_version(),
clash_core = clash_core(),
@ -328,6 +329,7 @@ function action_status()
e_mode = e_mode(),
in_use = in_use(),
conf_path = conf_path(),
uhttp_port = uhttp_port(),
typeconf = typeconf()
})
end
@ -390,11 +392,15 @@ function check_geoip_log()
local fdp=tonumber(fs.readfile("/var/run/geoiplog")) or 0
local f=io.open("/tmp/geoip_update.txt", "r+")
f:seek("set",fdp)
local a=f:read(2048000) or "."
local a=f:read(2048000) or ""
fdp=f:seek()
fs.writefile("/var/run/geoiplog",tostring(fdp))
f:close()
if fs.access("/var/run/geoip_update") then
luci.http.write(a)
else
luci.http.write(a.."\0")
end
end

View File

@ -1,69 +0,0 @@
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local uci = require("luci.model.uci").cursor()
local fs = require "luci.clash"
local http = luci.http
m = Map("clash")
s = m:section(TypedSection, "clash")
m.pageaction = false
s.anonymous = true
s.addremove=false
local conf = "/etc/clash/config.yaml"
sev = s:option(TextValue, "conf")
sev.readonly=true
sev.rows = 20
sev.wrap = "off"
sev.cfgvalue = function(self, section)
return NXFS.readfile(conf) or ""
end
sev.write = function(self, section, value)
end
o = s:option(Button,"configrm")
o.inputtitle = translate("Delete Config")
o.write = function()
os.execute("rm -rf /etc/clash/config.yaml 2>&1 &")
end
o = s:option(Button, "Download")
o.inputtitle = translate("Download Config")
o.inputstyle = "apply"
o.write = function ()
local sPath, sFile, fd, block
sPath = "/etc/clash/config.yaml"
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then
return
end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block ==0) then
break
else
HTTP.write(block)
end
end
fd:close()
HTTP.close()
end
return m

View File

@ -62,6 +62,7 @@ cc = s:option(Flag, "create", translate("Enable Create"))
cc.default = 1
cc.description = translate("Enable to create configuration")
o = s:option(Value, "create_tag")
o.title = translate("Config Name")
o.rmempty = true

View File

@ -1,10 +1,15 @@
local m, s, o
local clash = "clash"
local uci = luci.model.uci.cursor()
local fs = require "nixio.fs"
local sys = require "luci.sys"
local sid = arg[1]
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
local server_table = {}
local encrypt_methods_ss = {
"rc4-md5",
@ -81,7 +86,6 @@ if m.uci:get(clash, sid) ~= "servers" then
return
end
-- [[ Servers Setting ]]--
s = m:section(NamedSection, sid, "servers")
s.anonymous = true
@ -101,8 +105,6 @@ o:value("http", translate("HTTP(S)"))
o:value("snell", translate("Snell"))
o:value("trojan", translate("trojan"))
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
o = s:option(Value, "name", translate("Alias"))

View File

@ -1,6 +1,5 @@
<%+cbi/valueheader%>
<%local fs=require"nixio.fs"%>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="button" class="cbi-button cbi-button-apply" id="apply_update_button" value="<%:Download%>" onclick=" return apply_update() "/>
<br /><br />
<textarea id="core_download" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" rows="10" cols="100" readonly="readonly" > </textarea>
@ -17,15 +16,14 @@ function apply_update(){
function poll_check(){
var lv = document.getElementById('core_download');
lv.style.display="inline"
lv.innerText = ""
XHR.poll(2, '<%=url([[admin]], [[services]], [[clash]], [[check]])%>', null,
function(x, data) {
scroll();
var lv = document.getElementById('core_download');
if (x.responseText && lv) {
lv.innerHTML += x.responseText;
}
}
);
function(x, data) {
if(x && x.status === 200) {
if(typeof(x.responseText) === "string") {
lv.insertAdjacentText("beforeend", x.responseText);
lv.scrollTop = lv.scrollHeight;
}}});
}
@ -56,13 +54,6 @@ function hide(){
btn.value = '<%:Download%>';
}
function scroll(){
var textarea = document.getElementById('core_download');
textarea.scrollTop = textarea.scrollHeight;
}
<% if fs.access("/var/run/core_update") then %>
var btn = document.getElementById('apply_update_button');
btn.disabled = true;

View File

@ -1,6 +1,6 @@
<%+cbi/valueheader%>
<%local fs=require"nixio.fs"%>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="button" class="cbi-button cbi-button-apply" id="apply_update_geoip" value="<%:Download%>" onclick=" return apply_update() "/>
<br /><br />
<textarea id="geoip_download" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" rows="10" cols="100" readonly="readonly" > </textarea>
@ -17,12 +17,14 @@ function apply_update(){
function poll_check(){
var lv = document.getElementById('geoip_download');
lv.style.display="inline"
lv.innerText = ""
XHR.poll(2, '<%=url([[admin]], [[services]], [[clash]], [[check_geoip]])%>', null,
function(x, data) {
scroll();
var lv = document.getElementById('geoip_download');
if (x.responseText && lv) {
lv.innerHTML += x.responseText;
lv.scrollTop = lv.scrollHeight;
}
}
);
@ -58,10 +60,10 @@ function hide(){
}
function scroll(){
/*function scroll(){
var textarea = document.getElementById('geoip_download');
textarea.scrollTop = textarea.scrollHeight;
}
}*/
<% if fs.access("/var/run/geoip_update") then %>

View File

@ -1,5 +1,4 @@
<%
local dsp = require "luci.dispatcher"
-%>
@ -44,4 +43,5 @@ local dsp = require "luci.dispatcher"
);
}
//]]>
</script>
</script>

View File

@ -4,7 +4,7 @@
<script type="text/javascript">//<![CDATA[
var lv = document.getElementById('log');
lv.innerText = "Reading..."
lv.innerText = ""
lv.style.display="inline"
XHR.poll(3, '<%=url([[admin]], [[services]], [[clash]], [[logstatus]])%>', null,
function(x, data) {

View File

@ -1,4 +1,4 @@
#!/bin/bash /etc/rc.common
#!/bin/sh /etc/rc.common
START=99
STOP=15
@ -37,12 +37,12 @@ config_type=$(uci get clash.config.config_type 2>/dev/null)
[ -z "$(grep -w "/usr/share/clash/kill_watchdog.sh" $CRON_FILE)" ] && echo "*/1 * * * * /usr/share/clash/kill_watchdog.sh" >> $CRON_FILE
clear=$(uci get clash.config.auto_clear_log 2>/dev/null)
if [ "${clear}" -eq 1 ]; then
[ -z "$(grep -w "/usr/share/clash/clash.txt" $CRON_FILE)" ] && echo "0 */$(uci get clash.config.clear_time 2>/dev/null) * * * echo '' >/usr/share/clash/clash.txt" >> $CRON_FILE
[ -z "$(grep -w "/usr/share/clash/clash.txt" $CRON_FILE)" ] && echo "* */$(uci get clash.config.clear_time 2>/dev/null) * * * echo '' >/usr/share/clash/clash.txt" >> $CRON_FILE
fi
auto=$(uci get clash.config.auto_update 2>/dev/null)
if [ "${auto}" -eq 1 ]; then
[ -z "$(grep -w "/usr/share/clash/update_all.sh" $CRON_FILE)" ] && echo "0 */$(uci get clash.config.auto_update_time 2>/dev/null) * * * bash /usr/share/clash/update_all.sh >/usr/share/clash/clash.txt 2>&1 &" >> $CRON_FILE
[ -z "$(grep -w "/usr/share/clash/update_all.sh" $CRON_FILE)" ] && echo "* */$(uci get clash.config.auto_update_time 2>/dev/null) * * * bash /usr/share/clash/update_all.sh >/usr/share/clash/clash.txt 2>&1 &" >> $CRON_FILE
fi
auto_geoip=$(uci get clash.config.auto_update_geoip 2>/dev/null)
@ -255,8 +255,8 @@ rules(){
if [ "${enable_udp}" -eq 1 ]; then
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
ip route add local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" pref 789
ip route add local default dev lo table "$PROXY_ROUTE_TABLE"
iptables -t mangle -N clash
iptables -t mangle -A clash -d 0.0.0.0/8 -j RETURN
@ -273,7 +273,7 @@ rules(){
done
fi
iptables -t mangle -A clash -p udp -j TPROXY --on-port "${redir_port}" --on-ip 0.0.0.0 --tproxy-mark "$PROXY_FWMARK"
iptables -t mangle -A clash -p udp -j TPROXY --on-port "${redir_port}" --tproxy-mark "$PROXY_FWMARK"
iptables -t mangle -A PREROUTING -p udp -j clash
fi
@ -283,11 +283,13 @@ rules(){
if [ ! -z "${fake_ip_range}" ];then
if [ "${enable_udp}" -eq 1 ]; then
iptables -t nat -A OUTPUT -p tcp -d $fake_ip_range -j REDIRECT --to-ports "${redir_port}"
iptables -t mangle -A OUTPUT -p udp -d $fake_ip_range -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A OUTPUT -p udp -d $fake_ip_range -j MARK --set-mark "$PROXY_FWMARK"
fi
else
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.1/16 -j REDIRECT --to-ports "${redir_port}"
if [ "${enable_udp}" -eq 1 ]; then
iptables -t mangle -A OUTPUT -p udp -d 198.18.0.1/16 -j MARK --set-mark "$PROXY_FWMARK"
fi
fi
@ -306,7 +308,7 @@ rules(){
fi
done
fi
ip6tables -t mangle -A clash -p udp -j TPROXY --on-port "$proxy_port" --on-ip 0.0.0.0 --tproxy-mark "$PROXY_FWMARK"
ip6tables -t mangle -A clash -p udp -j TPROXY --on-port "$proxy_port" --tproxy-mark "$PROXY_FWMARK"
ip6tables -t mangle -A PREROUTING -p udp -j clash
fi

View File

@ -48,7 +48,7 @@ fi
if [ "${create}" -eq 1 ];then
if [ $lang == "en" ] || [ $lang == "auto" ];then
echo "Starting to Create Custom Config.. " >$REAL_LOG
echo "Starting to Create Custom Config.. " >$REAL_LOG
elif [ $lang == "zh_cn" ];then
echo "开始创建自定义配置..." >$REAL_LOG
fi

View File

@ -8,20 +8,19 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=rpcd
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
PKG_SOURCE_DATE:=2020-01-05
PKG_SOURCE_VERSION:=efe51f41d6288fa8503cc4f2efb37a777767d505
PKG_SOURCE_DATE:=2020-05-26
PKG_SOURCE_VERSION:=7be1f17138f19d1d7a86e0c27b3662d3643ff296
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_MIRROR_HASH:=cf4bd4670ce8d49f5fb97f0e74a817324c1a503c90527282e30365d8b9a2e17a
PKG_MIRROR_HASH:=b427b2be8ebd486edbc88f6e789d1890cbdda1b4f04dcfcc8751f568c3a82674
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=
PKG_BUILD_PARALLEL:=1
PKG_ASLR_PIE_REGULAR:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

View File

@ -19,3 +19,7 @@ start_service() {
reload_service() {
procd_send_signal rpcd
}
service_running() {
procd_running rpcd
}

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ugps.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2020-04-29
PKG_SOURCE_VERSION:=db40e3a22599641be68c88ece287d3fbbacd8a45
PKG_MIRROR_HASH:=0ad8b1265ef3de880f0d7623bcf504e7976df8ee06d64e92f896f2e2a6030c39
PKG_SOURCE_DATE:=2020-05-29
PKG_SOURCE_VERSION:=0c54380e3d8920100fcfd41f0a1fe9872eb37d0e
PKG_MIRROR_HASH:=cf7e5af73f9feabf643f988c040fd3783dc44c6f4b1ecada0957d4ee3d67c14e
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=GPL-2.0+

View File

@ -16,6 +16,7 @@ gconf
#
# temporary files from older version. Should be removed
#
mconf_check
zconf.???.c
zconf.hash.c
.tmp_qtcheck

View File

@ -575,6 +575,8 @@ define Device/tl-wr902ac-v1
SUPPORTED_DEVICES := tl-wr902ac-v1
IMAGE_SIZE := 7360k
MTDPARTS := spi0.0:128k(u-boot)ro,7360k(firmware),640k(tplink)ro,64k(art)ro
KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header -O
KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | tplink-v1-header
endef
TARGET_DEVICES += tl-wr902ac-v1

View File

@ -11,8 +11,8 @@ PKG_VERSION:=2.31
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=109474122400ca7d60782b131dc867a5c1f2fe55
PKG_MIRROR_HASH:=5a04a24e69eace9eb892f0b48b869d31d4900ad656099064b6a9d8a342c13d8c
PKG_SOURCE_VERSION:=3a44844c97a8ca1d0798c45b5252e6a49f9cf8e1
PKG_MIRROR_HASH:=d7206510e494b3c723173d8ec0dd2e41314da59075871c5642324688001b3f6e
PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz

View File

@ -0,0 +1,51 @@
From 4d5aa20a94a2d3fae3e69289dc23ecafbd0c16c4 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 22 May 2020 17:35:14 -0400
Subject: [PATCH 1/4] reorder thread list unlink in pthread_exit after all
locks
since the backend for LOCK() skips locking if single-threaded, it's
unsafe to make the process appear single-threaded before the last use
of lock.
this fixes potential unsynchronized access to a linked list via
__dl_thread_cleanup.
---
src/thread/pthread_create.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -90,14 +90,7 @@ _Noreturn void __pthread_exit(void *resu
exit(0);
}
- /* At this point we are committed to thread termination. Unlink
- * the thread from the list. This change will not be visible
- * until the lock is released, which only happens after SYS_exit
- * has been called, via the exit futex address pointing at the lock. */
- libc.threads_minus_1--;
- self->next->prev = self->prev;
- self->prev->next = self->next;
- self->prev = self->next = self;
+ /* At this point we are committed to thread termination. */
/* Process robust list in userspace to handle non-pshared mutexes
* and the detached thread case where the robust list head will
@@ -121,6 +114,16 @@ _Noreturn void __pthread_exit(void *resu
__do_orphaned_stdio_locks();
__dl_thread_cleanup();
+ /* Last, unlink thread from the list. This change will not be visible
+ * until the lock is released, which only happens after SYS_exit
+ * has been called, via the exit futex address pointing at the lock.
+ * This needs to happen after any possible calls to LOCK() that might
+ * skip locking if libc.threads_minus_1 is zero. */
+ libc.threads_minus_1--;
+ self->next->prev = self->prev;
+ self->prev->next = self->next;
+ self->prev = self->next = self;
+
/* This atomic potentially competes with a concurrent pthread_detach
* call; the loser is responsible for freeing thread resources. */
int state = a_cas(&self->detach_state, DT_JOINABLE, DT_EXITING);

View File

@ -0,0 +1,69 @@
From e01b5939b38aea5ecbe41670643199825874b26c Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Thu, 21 May 2020 23:32:45 -0400
Subject: [PATCH 2/4] don't use libc.threads_minus_1 as relaxed atomic for
skipping locks
after all but the last thread exits, the next thread to observe
libc.threads_minus_1==0 and conclude that it can skip locking fails to
synchronize with any changes to memory that were made by the
last-exiting thread. this can produce data races.
on some archs, at least x86, memory synchronization is unlikely to be
a problem; however, with the inline locks in malloc, skipping the lock
also eliminated the compiler barrier, and caused code that needed to
re-check chunk in-use bits after obtaining the lock to reuse a stale
value, possibly from before the process became single-threaded. this
in turn produced corruption of the heap state.
some uses of libc.threads_minus_1 remain, especially for allocation of
new TLS in the dynamic linker; otherwise, it could be removed
entirely. it's made non-volatile to reflect that the remaining
accesses are only made under lock on the thread list.
instead of libc.threads_minus_1, libc.threaded is now used for
skipping locks. the difference is that libc.threaded is permanently
true once an additional thread has been created. this will produce
some performance regression in processes that are mostly
single-threaded but occasionally creating threads. in the future it
may be possible to bring back the full lock-skipping, but more care
needs to be taken to produce a safe design.
---
src/internal/libc.h | 2 +-
src/malloc/malloc.c | 2 +-
src/thread/__lock.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- a/src/internal/libc.h
+++ b/src/internal/libc.h
@@ -21,7 +21,7 @@ struct __libc {
int can_do_threads;
int threaded;
int secure;
- volatile int threads_minus_1;
+ int threads_minus_1;
size_t *auxv;
struct tls_module *tls_head;
size_t tls_size, tls_align, tls_cnt;
--- a/src/malloc/malloc.c
+++ b/src/malloc/malloc.c
@@ -26,7 +26,7 @@ int __malloc_replaced;
static inline void lock(volatile int *lk)
{
- if (libc.threads_minus_1)
+ if (libc.threaded)
while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1);
}
--- a/src/thread/__lock.c
+++ b/src/thread/__lock.c
@@ -18,7 +18,7 @@
void __lock(volatile int *l)
{
- if (!libc.threads_minus_1) return;
+ if (!libc.threaded) return;
/* fast path: INT_MIN for the lock, +1 for the congestion */
int current = a_cas(l, 0, INT_MIN + 1);
if (!current) return;

View File

@ -0,0 +1,25 @@
From f12888e9eb9eed60cc266b899dcafecb4752964a Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 22 May 2020 17:25:38 -0400
Subject: [PATCH 3/4] cut down size of some libc struct members
these are all flags that can be single-byte values.
---
src/internal/libc.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/src/internal/libc.h
+++ b/src/internal/libc.h
@@ -18,9 +18,9 @@ struct tls_module {
};
struct __libc {
- int can_do_threads;
- int threaded;
- int secure;
+ char can_do_threads;
+ char threaded;
+ char secure;
int threads_minus_1;
size_t *auxv;
struct tls_module *tls_head;

View File

@ -0,0 +1,90 @@
From 8d81ba8c0bc6fe31136cb15c9c82ef4c24965040 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 22 May 2020 17:45:47 -0400
Subject: [PATCH 4/4] restore lock-skipping for processes that return to
single-threaded state
the design used here relies on the barrier provided by the first lock
operation after the process returns to single-threaded state to
synchronize with actions by the last thread that exited. by storing
the intent to change modes in the same object used to detect whether
locking is needed, it's possible to avoid an extra (possibly costly)
memory load after the lock is taken.
---
src/internal/libc.h | 1 +
src/malloc/malloc.c | 5 ++++-
src/thread/__lock.c | 4 +++-
src/thread/pthread_create.c | 8 ++++----
4 files changed, 12 insertions(+), 6 deletions(-)
--- a/src/internal/libc.h
+++ b/src/internal/libc.h
@@ -21,6 +21,7 @@ struct __libc {
char can_do_threads;
char threaded;
char secure;
+ volatile signed char need_locks;
int threads_minus_1;
size_t *auxv;
struct tls_module *tls_head;
--- a/src/malloc/malloc.c
+++ b/src/malloc/malloc.c
@@ -26,8 +26,11 @@ int __malloc_replaced;
static inline void lock(volatile int *lk)
{
- if (libc.threaded)
+ int need_locks = libc.need_locks;
+ if (need_locks) {
while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1);
+ if (need_locks < 0) libc.need_locks = 0;
+ }
}
static inline void unlock(volatile int *lk)
--- a/src/thread/__lock.c
+++ b/src/thread/__lock.c
@@ -18,9 +18,11 @@
void __lock(volatile int *l)
{
- if (!libc.threaded) return;
+ int need_locks = libc.need_locks;
+ if (!need_locks) return;
/* fast path: INT_MIN for the lock, +1 for the congestion */
int current = a_cas(l, 0, INT_MIN + 1);
+ if (need_locks < 0) libc.need_locks = 0;
if (!current) return;
/* A first spin loop, for medium congestion. */
for (unsigned i = 0; i < 10; ++i) {
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -118,8 +118,8 @@ _Noreturn void __pthread_exit(void *resu
* until the lock is released, which only happens after SYS_exit
* has been called, via the exit futex address pointing at the lock.
* This needs to happen after any possible calls to LOCK() that might
- * skip locking if libc.threads_minus_1 is zero. */
- libc.threads_minus_1--;
+ * skip locking if process appears single-threaded. */
+ if (!--libc.threads_minus_1) libc.need_locks = -1;
self->next->prev = self->prev;
self->prev->next = self->next;
self->prev = self->next = self;
@@ -339,7 +339,7 @@ int __pthread_create(pthread_t *restrict
~(1UL<<((SIGCANCEL-1)%(8*sizeof(long))));
__tl_lock();
- libc.threads_minus_1++;
+ if (!libc.threads_minus_1++) libc.need_locks = 1;
ret = __clone((c11 ? start_c11 : start), stack, flags, args, &new->tid, TP_ADJ(new), &__thread_list_lock);
/* All clone failures translate to EAGAIN. If explicit scheduling
@@ -363,7 +363,7 @@ int __pthread_create(pthread_t *restrict
new->next->prev = new;
new->prev->next = new;
} else {
- libc.threads_minus_1--;
+ if (!--libc.threads_minus_1) libc.need_locks = 0;
}
__tl_unlock();
__restore_sigs(&set);