From 61288e1dd2c594f96adf86bc7f5b1bf84bf33f9b Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sun, 6 Dec 2020 11:20:06 +0800 Subject: [PATCH 01/15] mt7601u-ap: add package Note: Need to increase coherent_pool size to 2MB on some arm64 platforms to work properly. --- package/ctcgfw/mt7601u-ap/Makefile | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 package/ctcgfw/mt7601u-ap/Makefile diff --git a/package/ctcgfw/mt7601u-ap/Makefile b/package/ctcgfw/mt7601u-ap/Makefile new file mode 100644 index 0000000000..56fb9ae7ea --- /dev/null +++ b/package/ctcgfw/mt7601u-ap/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2020 CTCGFW Project-OpenWrt +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mt7601u-ap +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2020-05-01 +PKG_SOURCE_URL:=https://github.com/Anthony96922/mt7601u-ap.git +PKG_SOURCE_VERSION:=624307427149e53b75937ccbe7cb235ec3ef2f58 +PKG_MIRROR_HASH:=70e8f7e94ddca09e1f55ef1b30a47fa7c504750ec654bc0c500f1a3d491eca97 + +PKG_MAINTAINER:=[CTCGFW] Project OpenWrt +PKG_BUILD_PARALLEL:=1 + +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/mt7601u-ap + SUBMENU:=Wireless Drivers + TITLE:=AP driver for MT7601U dongles + DEPENDS:=+kmod-usb-core +wireless-tools @USB_SUPPORT + FILES:=$(PKG_BUILD_DIR)/os/linux/mt7601Uap.ko + AUTOLOAD:=$(call AutoProbe,mt7601Uap) + CONFLICTS:=kmod-mt7601u +endef + +define KernelPackage/mt7601u-ap/description + AP driver for MT7601U chipset based adapters +endef + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(KERNEL_CROSS)" \ + LINUX_SRC="$(LINUX_DIR)" \ + RT28xx_DIR="$(PKG_BUILD_DIR)" \ + RT28xx_MODE=AP \ + CHIPSET=7601U \ + MODULE=7601U \ + OSABL=NO \ + +define Build/Prepare + $(Build/Prepare/Default) + $(CP) $(PKG_BUILD_DIR)/os/linux/Makefile.6 $(PKG_BUILD_DIR)/os/linux/Makefile +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + M="$(PKG_BUILD_DIR)/os/linux" \ + modules +endef + +define KernelPackage/mt7601u-ap/install + $(INSTALL_DIR) $(1)/etc/wifi/RT2870AP + $(INSTALL_DATA) $(PKG_BUILD_DIR)/RT2870AP.txt $(1)/etc/wifi/RT2870AP/ +endef + +$(eval $(call KernelPackage,mt7601u-ap)) From 624ffb109b6ed6a69f6ff74eec959d23d779a22d Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 2 Jan 2021 19:05:08 +0800 Subject: [PATCH 02/15] luci-app-adguardhome: adjust config for upstream --- .../ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome b/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome index cd0c543215..1169488333 100644 --- a/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome +++ b/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome @@ -2,10 +2,10 @@ config AdGuardHome 'AdGuardHome' option enabled '0' option httpport '3000' option redirect 'none' - option configpath '/etc/AdGuardHome.yaml' - option workdir '/usr/bin/AdGuardHome' + option configpath '/etc/AdGuardHome/AdGuardHome.yaml' + option workdir '/etc/AdGuardHome' option logfile '/tmp/AdGuardHome.log' option verbose '0' - option binpath '/usr/bin/AdGuardHome/AdGuardHome' + option binpath '/usr/bin/AdGuardHome' option upxflag '' From 4e392ee4f5fce1d892431164fe5147ba0431807a Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 2 Jan 2021 19:07:45 +0800 Subject: [PATCH 03/15] Revert "luci-app-adguardhome: adjust config for upstream" This reverts commit 624ffb109b6ed6a69f6ff74eec959d23d779a22d. --- .../ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome b/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome index 1169488333..cd0c543215 100644 --- a/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome +++ b/package/ctcgfw/luci-app-adguardhome/root/etc/config/AdGuardHome @@ -2,10 +2,10 @@ config AdGuardHome 'AdGuardHome' option enabled '0' option httpport '3000' option redirect 'none' - option configpath '/etc/AdGuardHome/AdGuardHome.yaml' - option workdir '/etc/AdGuardHome' + option configpath '/etc/AdGuardHome.yaml' + option workdir '/usr/bin/AdGuardHome' option logfile '/tmp/AdGuardHome.log' option verbose '0' - option binpath '/usr/bin/AdGuardHome' + option binpath '/usr/bin/AdGuardHome/AdGuardHome' option upxflag '' From 4e90b9a9a2ac543eb03cbdfd2ca564d0050bfffa Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 2 Jan 2021 19:39:32 +0800 Subject: [PATCH 04/15] bpytop: bump to 1.0.54 --- package/ctcgfw/bpytop/Makefile | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/package/ctcgfw/bpytop/Makefile b/package/ctcgfw/bpytop/Makefile index 2908832451..eae751164d 100644 --- a/package/ctcgfw/bpytop/Makefile +++ b/package/ctcgfw/bpytop/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bpytop -PKG_VERSION:=1.0.53 +PKG_VERSION:=1.0.54 PKG_RELEASE:=1 PYPI_NAME:=bpytop -PKG_HASH:=d08b8120444e7f35fe032b33495ca551b5890702130c45ad8a56c1fa978fc358 +PKG_HASH:=a25665e71627a5ec918e6ecf4422bea1ba449069958f64c3879029cfb58a0ac1 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE @@ -35,17 +35,11 @@ define Package/bpytop/description endef define Package/bpytop/install - $(call Py3Package/$(1)/install,$(1)) - $(call Py3Package/ProcessFilespec,$(1),$(PKG_INSTALL_DIR),$(1)) - $(FIND) $(1) -name '*.exe' -delete - $(call Python3/CompileAll,$(1)) - $(call Python3/DeleteSourceFiles,$(1)) - $(call Python3/DeleteEmptyDirs,$(1)) - if [ -d "$(1)/usr/bin" ]; then \ - $(call Python3/FixShebang,$(1)/usr/bin/*) ; \ - fi - $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/bpytop - $(CP) $(PKG_BUILD_DIR)/bpytop-themes/* $(PKG_INSTALL_DIR)/usr/share/bpytop/ + $(call Py3Package/$(1)/install,$(PKG_BUILD_DIR)) + $(INSTALL_DIR) $(1)/usr + $(CP) $(PKG_INSTALL_DIR)/usr/* $(1)/usr/ + $(INSTALL_DIR) $(1)/usr/share/bpytop + $(CP) $(PKG_BUILD_DIR)/bpytop-themes/* $(1)/usr/share/bpytop/ endef $(eval $(call Py3Package,bpytop)) From 5ed2c93cafb81d4b9b9f1cb2baf712a4f9226298 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 2 Jan 2021 14:36:03 +0100 Subject: [PATCH 05/15] wolfssl: enable HAVE_SECRET_CALLBACK Fixes wpad-wolfssl build Signed-off-by: Felix Fietkau --- .../wolfssl/patches/120-enable-secret-callback.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 package/libs/wolfssl/patches/120-enable-secret-callback.patch diff --git a/package/libs/wolfssl/patches/120-enable-secret-callback.patch b/package/libs/wolfssl/patches/120-enable-secret-callback.patch new file mode 100644 index 0000000000..9c9b361d01 --- /dev/null +++ b/package/libs/wolfssl/patches/120-enable-secret-callback.patch @@ -0,0 +1,10 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -943,6 +943,7 @@ then + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI" + AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA" + AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE" ++ AM_CFLAGS="$AM_CFLAGS -DHAVE_SECRET_CALLBACK" + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EITHER_SIDE" + AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA_X509_SMALL" + From 1ba328bf73d3f55ed60e2fdae8273b820071744a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 22 Dec 2020 10:33:02 +0100 Subject: [PATCH 06/15] build: replace which with Bash command built-in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `which` utility is not shipped by default for example on recent Arch Linux and then any steps relying on its presence fails, like for example following Python3 prereq build check: $ python3 --version Python 3.9.1 $ make /bin/sh: line 1: which: command not found /bin/sh: line 1: which: command not found /bin/sh: line 1: which: command not found ... Checking 'python3'... failed. ... Fix this by switching to Bash builtin `command` which should provide same functionality. Fixes: FS#3525 Signed-off-by: Petr Štetiar --- Makefile | 2 +- include/cmake.mk | 2 +- include/prereq.mk | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4ccbc20b85..f1577ad4d1 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir world: -DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1) +DISTRO_PKG_CONFIG:=$(shell command -pv pkg-config | grep -E '\/usr' | head -n 1) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) diff --git a/include/cmake.mk b/include/cmake.mk index 96c4d7df34..de8022ca57 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -15,7 +15,7 @@ MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .) ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1) else - cmake_tool=$(shell which $(1)) + cmake_tool=$(shell command -v $(1)) endif ifeq ($(CONFIG_CCACHE),) diff --git a/include/prereq.mk b/include/prereq.mk index 83ac21242c..6d14140792 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -52,7 +52,7 @@ endef define RequireCommand define Require/$(1) - which $(1) + command -pv $(1) endef $$(eval $$(call Require,$(1),$(2))) @@ -106,7 +106,7 @@ define SetupHostCommand $(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \ if [ -n "$$$$$$$$cmd" ]; then \ bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \ - which "$$$$$$$${cmd%% *}")"; \ + command -pv "$$$$$$$${cmd%% *}")"; \ if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \ mkdir -p "$(STAGING_DIR_HOST)/bin"; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ From 1146051a203c38f26fbe5e4ec306e73436ef81db Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Sat, 28 Nov 2020 17:38:54 +0000 Subject: [PATCH 07/15] build: drop clang wrapper clang's gcc emulation does the right thing with -print-file-name now, drop the wrapper Signed-off-by: Kevin Darbyshire-Bryant --- include/toplevel.mk | 10 +--------- scripts/clang-gcc-wrapper | 12 ------------ 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100755 scripts/clang-gcc-wrapper diff --git a/include/toplevel.mk b/include/toplevel.mk index 4003b48241..d3500ef58f 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -19,7 +19,6 @@ else SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh) endif -HOSTCC ?= $(CC) export REVISION export SOURCE_DATE_EPOCH export GIT_CONFIG_PARAMETERS='core.autocrlf=false' @@ -59,13 +58,6 @@ export PATH:=$(path) unexport TAR_OPTIONS -ifneq ($(shell $(HOSTCC) 2>&1 | grep clang),) - export HOSTCC_REAL?=$(HOSTCC) - export HOSTCC_WRAPPER:=$(TOPDIR)/scripts/clang-gcc-wrapper -else - export HOSTCC_WRAPPER:=$(HOSTCC) -endif - ifeq ($(FORCE),) .config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build endif @@ -115,7 +107,7 @@ endif scripts/config/%onf: CFLAGS+= -O2 scripts/config/%onf: @$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \ - -C scripts/config $(notdir $@) CC="$(HOSTCC_WRAPPER)" + -C scripts/config $(notdir $@) $(eval $(call rdep,scripts/config,scripts/config/mconf)) diff --git a/scripts/clang-gcc-wrapper b/scripts/clang-gcc-wrapper deleted file mode 100755 index 9e668418a9..0000000000 --- a/scripts/clang-gcc-wrapper +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -_cc="${HOSTCC_REAL:-gcc}" -case "$1" in - -print-file-name=*) - dirs="$($_cc -print-search-dirs | grep -m1 libraries | sed -e 's,:, ,' -e 's,.* =,,')" - dirs="$dirs /usr/lib /usr/local/lib" - find $dirs -name "${1#*=}" | head -n1 - ;; - *) - exec $_cc "$@" - ;; -esac From 4bfb7abcbdd153b9ecbdad80c662b8d9417b6bd5 Mon Sep 17 00:00:00 2001 From: Syrone Wong Date: Fri, 1 Jan 2021 21:50:43 +0800 Subject: [PATCH 08/15] tools/fakeroot: update to 1.25.3 use PKG_FIXUP:=autoreconf to generate configure 200-hide-dlsym-error.patch deleted due to fixed upstream in another way other patches refreshed to reflect latest changes Signed-off-by: Syrone Wong --- tools/Makefile | 1 + tools/fakeroot/Makefile | 7 ++-- tools/fakeroot/patches/000-relocatable.patch | 6 ++-- tools/fakeroot/patches/100-portability.patch | 28 ++++++---------- tools/fakeroot/patches/200-disable-doc.patch | 10 ++++++ .../patches/200-hide-dlsym-error.patch | 32 ------------------- 6 files changed, 27 insertions(+), 57 deletions(-) create mode 100644 tools/fakeroot/patches/200-disable-doc.patch delete mode 100644 tools/fakeroot/patches/200-hide-dlsym-error.patch diff --git a/tools/Makefile b/tools/Makefile index d1eb407f95..98737e212a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -49,6 +49,7 @@ $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile +$(curdir)/fakeroot/compile := $(curdir)/libtool/compile $(curdir)/findutils/compile := $(curdir)/bison/compile $(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile $(curdir)/flex/compile := $(curdir)/libtool/compile diff --git a/tools/fakeroot/Makefile b/tools/fakeroot/Makefile index 8c30ee71c3..e9daa4b6ad 100644 --- a/tools/fakeroot/Makefile +++ b/tools/fakeroot/Makefile @@ -5,14 +5,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fakeroot -PKG_VERSION:=1.24 -PKG_RELEASE:=2 +PKG_VERSION:=1.25.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz PKG_SOURCE_URL:=http://deb.debian.org/debian/pool/main/f/fakeroot -PKG_HASH:=2e045b3160370b8ab4d44d1f8d267e5d1d555f1bb522d650e7167b09477266ed +PKG_HASH:=8e903683357f7f5bcc31b879fd743391ad47691d4be33d24a76be3b6c21e956c PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE_FILES:=COPYING +PKG_FIXUP:=autoreconf include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/fakeroot/patches/000-relocatable.patch b/tools/fakeroot/patches/000-relocatable.patch index 0408acfa25..44897c5ab8 100644 --- a/tools/fakeroot/patches/000-relocatable.patch +++ b/tools/fakeroot/patches/000-relocatable.patch @@ -8,7 +8,7 @@ -FAKEROOT_BINDIR=@bindir@ +if [ -n "$STAGING_DIR_HOST" ]; then + USEABSLIBPATH=1 -+ LIB=${STAGING_DIR_HOST}/lib/lib@fakeroot_transformed@@DLSUFFIX@ ++ FAKEROOT_LIB=${STAGING_DIR_HOST}/lib/lib@fakeroot_transformed@@DLSUFFIX@ + FAKED=${STAGING_DIR_HOST}/bin/faked + PATHS= +else @@ -16,11 +16,11 @@ + FAKEROOT_BINDIR=@bindir@ -USEABSLIBPATH=@LDPRELOADABS@ --LIB=lib@fakeroot_transformed@@DLSUFFIX@ +-FAKEROOT_LIB=lib@fakeroot_transformed@@DLSUFFIX@ -PATHS=@libdir@:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot -FAKED=${FAKEROOT_BINDIR}/@faked_transformed@ + USEABSLIBPATH=@LDPRELOADABS@ -+ LIB=lib@fakeroot_transformed@@DLSUFFIX@ ++ FAKEROOT_LIB=lib@fakeroot_transformed@@DLSUFFIX@ + PATHS=@libdir@:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot + FAKED=${FAKEROOT_BINDIR}/@faked_transformed@ +fi diff --git a/tools/fakeroot/patches/100-portability.patch b/tools/fakeroot/patches/100-portability.patch index 5713c9e3fe..315a9e16bf 100644 --- a/tools/fakeroot/patches/100-portability.patch +++ b/tools/fakeroot/patches/100-portability.patch @@ -1,9 +1,9 @@ --- a/libfakeroot.c +++ b/libfakeroot.c -@@ -110,8 +110,16 @@ - #define INT_NEXT_FSTATAT(a,b,c,d) NEXT_FSTATAT(_STAT_VER,a,b,c,d) +@@ -112,8 +112,16 @@ #define INT_SEND_STAT(a,b) SEND_STAT(a,b,_STAT_VER) #define INT_SEND_GET_XATTR(a,b) SEND_GET_XATTR(a,b,_STAT_VER) + #define INT_SEND_GET_STAT(a,b) SEND_GET_STAT(a,b) + +/* 10.10 uses id_t in getpriority/setpriority calls, so pretend + id_t is used everywhere, just happens to be int on some OSes */ @@ -17,7 +17,7 @@ #include #include #include -@@ -123,7 +131,6 @@ +@@ -125,7 +133,6 @@ #include #include #include @@ -25,7 +25,7 @@ #ifdef HAVE_SYS_ACL_H #include #endif /* HAVE_SYS_ACL_H */ -@@ -1894,7 +1901,7 @@ ssize_t fremovexattr(int fd, const char +@@ -1911,7 +1918,7 @@ ssize_t fremovexattr(int fd, const char } #endif /* HAVE_FREMOVEXATTR */ @@ -34,7 +34,7 @@ if (fakeroot_disabled) return next_setpriority(which, who, prio); next_setpriority(which, who, prio); -@@ -2426,3 +2433,19 @@ int sysinfo(int command, char *buf, long +@@ -2520,3 +2527,19 @@ int sysinfo(int command, char *buf, long } } #endif @@ -56,16 +56,16 @@ +#endif --- a/wrapfunc.inp +++ b/wrapfunc.inp -@@ -145,7 +145,7 @@ setfsgid;gid_t;(gid_t fsgid);(fsgid) - #endif /* HAVE_SETFSGID */ +@@ -146,7 +146,7 @@ setfsgid;gid_t;(gid_t fsgid);(fsgid) initgroups;int;(const char *user, INITGROUPS_SECOND_ARG group);(user, group) + getgroups;int;(int size, gid_t list[]);(size, list) setgroups;int;(SETGROUPS_SIZE_TYPE size, const gid_t *list);(size, list) -setpriority;int;(int which, int who, int prio);(which, who, prio) +setpriority;int;(int which, id_t who, int prio);(which, who, prio) #ifdef HAVE_CAPSET capset;int;(cap_user_header_t hdrp, const cap_user_data_t datap);(hdrp, datap) #endif /* HAVE_CAPSET */ -@@ -197,7 +197,7 @@ fchownat;int;(int dir_fd, const char *pa +@@ -198,7 +198,7 @@ fchownat;int;(int dir_fd, const char *pa mkdirat;int;(int dir_fd, const char *pathname, mode_t mode);(dir_fd, pathname, mode) #endif /* HAVE_MKDIRAT */ #ifdef HAVE_OPENAT @@ -112,17 +112,7 @@ print "static __inline__ " ret " next_" name, argtype " {" > tmpffile; --- a/configure.ac +++ b/configure.ac -@@ -110,6 +110,7 @@ for first in size_t int; do - #include - #endif - #include -+#include - #ifdef HAVE_GRP_H - #include - #endif ---- a/configure -+++ b/configure -@@ -12847,6 +12847,7 @@ for first in size_t int; do +@@ -146,6 +146,7 @@ for first in size_t int; do #include #endif #include diff --git a/tools/fakeroot/patches/200-disable-doc.patch b/tools/fakeroot/patches/200-disable-doc.patch new file mode 100644 index 0000000000..29a3e39b2d --- /dev/null +++ b/tools/fakeroot/patches/200-disable-doc.patch @@ -0,0 +1,10 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,6 +1,6 @@ + AUTOMAKE_OPTIONS=foreign + ACLOCAL_AMFLAGS = -I build-aux +-SUBDIRS=doc scripts test ++SUBDIRS=scripts test + + noinst_LTLIBRARIES = libcommunicate.la libmacosx.la + libcommunicate_la_SOURCES = communicate.c diff --git a/tools/fakeroot/patches/200-hide-dlsym-error.patch b/tools/fakeroot/patches/200-hide-dlsym-error.patch deleted file mode 100644 index 3fd34c8778..0000000000 --- a/tools/fakeroot/patches/200-hide-dlsym-error.patch +++ /dev/null @@ -1,32 +0,0 @@ -Description: Hide error from dlsym() - dlsym(), starting in glibc 2.24 actually reports errors. In our case, - we try to get ACL functions which are not in the glibc. This causes - failures in test suites, so hide those messages for non-debugging - purposes for now. It also makes the build logs annoying to read. -Author: Julian Andres Klode -Origin: vendor -Bug-Debian: https://bugs.debian.org/830912 -Forwarded: no -Last-Update: 2016-08-12 - ---- a/libfakeroot.c -+++ b/libfakeroot.c -@@ -256,10 +256,16 @@ void load_library_symbols(void){ - /* clear dlerror() just in case dlsym() legitimately returns NULL */ - msg = dlerror(); - *(next_wrap[i].doit)=dlsym(get_libc(), next_wrap[i].name); -+ - if ( (msg = dlerror()) != NULL){ -- fprintf (stderr, "dlsym(%s): %s\n", next_wrap[i].name, msg); --/* abort ();*/ -+#ifdef LIBFAKEROOT_DEBUGGING -+ if (fakeroot_debug) { -+ fprintf (stderr, "dlsym(%s): %s\n", next_wrap[i].name, msg); -+/* abort ();*/ -+ } -+#endif - } -+ - } - } - From 6bb37834f02cd3bd578d14d9cdfad94f78bf425f Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Mon, 4 Jan 2021 19:35:26 +0800 Subject: [PATCH 09/15] luci-app-passwall: bump to 4-6 --- package/lienol/luci-app-passwall/Makefile | 8 +- .../luasrc/controller/passwall.lua | 44 ++--- .../model/cbi/passwall/api/gen_xray.lua | 1 + .../luasrc/model/cbi/passwall/client/acl.lua | 14 -- .../model/cbi/passwall/client/auto_switch.lua | 24 +-- .../model/cbi/passwall/client/global.lua | 108 ++++++------ .../model/cbi/passwall/client/node_config.lua | 2 + .../model/cbi/passwall/client/other.lua | 21 +-- .../model/cbi/passwall/client/rule_list.lua | 78 +-------- .../model/cbi/passwall/server/api/xray.lua | 31 +++- .../luasrc/model/cbi/passwall/server/user.lua | 25 ++- .../luasrc/view/passwall/global/footer.htm | 51 +++--- .../luasrc/view/passwall/global/status.htm | 13 +- .../luasrc/view/passwall/global/status2.htm | 13 +- .../passwall/node_list/link_share_man.htm | 5 + .../view/passwall/node_list/node_list.htm | 21 +-- .../luci-app-passwall/po/zh-cn/passwall.po | 3 - .../root/etc/config/passwall | 10 +- .../root/usr/share/passwall/app.sh | 122 ++++++-------- .../root/usr/share/passwall/iptables.sh | 154 ++++++------------ .../root/usr/share/passwall/monitor.sh | 61 +++---- .../root/usr/share/passwall/subscribe.lua | 53 +++--- .../root/usr/share/passwall/test.sh | 43 ++--- 23 files changed, 327 insertions(+), 578 deletions(-) diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index c57ca08c26..81094c77f3 100644 --- a/package/lienol/luci-app-passwall/Makefile +++ b/package/lienol/luci-app-passwall/Makefile @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=4 -PKG_RELEASE:=4 -PKG_DATE:=20201221 +PKG_RELEASE:=6 +PKG_DATE:=20210104 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) @@ -136,10 +136,6 @@ define Package/$(PKG_NAME)/conffiles /usr/share/passwall/rules/direct_ip /usr/share/passwall/rules/proxy_host /usr/share/passwall/rules/proxy_ip -/usr/share/passwall/rules/proxy_host2 -/usr/share/passwall/rules/proxy_ip2 -/usr/share/passwall/rules/proxy_host3 -/usr/share/passwall/rules/proxy_ip3 endef define Package/$(PKG_NAME)/install diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index 75b10d9424..e1375137f0 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -135,21 +135,13 @@ end function get_now_use_node() local e = {} - local tcp_node_num = ucic:get(appname, "@global_other[0]", "tcp_node_num") or 1 - e.tcp = tonumber(tcp_node_num) - for i = 1, tcp_node_num, 1 do - local data, code, msg = nixio.fs.readfile("/var/etc/passwall/id/TCP_" .. i) - if data then - e["TCP" .. i] = util.trim(data) - end + local data, code, msg = nixio.fs.readfile("/var/etc/passwall/id/TCP") + if data then + e["TCP"] = util.trim(data) end - local udp_node_num = ucic:get(appname, "@global_other[0]", "udp_node_num") or 1 - e.udp = tonumber(udp_node_num) - for i = 1, udp_node_num, 1 do - local data, code, msg = nixio.fs.readfile("/var/etc/passwall/id/UDP_" .. i) - if data then - e["UDP" .. i] = util.trim(data) - end + local data, code, msg = nixio.fs.readfile("/var/etc/passwall/id/UDP") + if data then + e["UDP"] = util.trim(data) end luci.http.prepare_content("application/json") luci.http.write_json(e) @@ -158,8 +150,7 @@ end function get_redir_log() local proto = luci.http.formvalue("proto") proto = proto:upper() - local index = luci.http.formvalue("index") - local filename = proto .. "_" .. index + local filename = proto if nixio.fs.access("/var/etc/passwall/" .. filename .. ".log") then local content = luci.sys.exec("cat /var/etc/passwall/" .. filename .. ".log") content = content:gsub("\n", "
") @@ -183,19 +174,13 @@ function status() local e = {} e.dns_mode_status = luci.sys.call("netstat -apn | grep ':7913 ' >/dev/null") == 0 e.haproxy_status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 - local tcp_node_num = ucic:get(appname, "@global_other[0]", "tcp_node_num") or 1 - for i = 1, tcp_node_num, 1 do - e["kcptun_tcp_node%s_status" % i] = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/kcptun' | grep -i 'tcp_%s' >/dev/null", appname, i)) == 0 - e["tcp_node%s_status" % i] = luci.sys.call(string.format("ps -w | grep -v -E 'grep|kcptun' | grep '%s/bin/' | grep -i 'TCP_%s' >/dev/null", appname, i)) == 0 - end + e["kcptun_tcp_node_status"] = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/kcptun' | grep -i 'tcp' >/dev/null", appname)) == 0 + e["tcp_node_status"] = luci.sys.call(string.format("ps -w | grep -v -E 'grep|kcptun' | grep '%s/bin/' | grep -i 'TCP' >/dev/null", appname)) == 0 - local udp_node_num = ucic:get(appname, "@global_other[0]", "udp_node_num") or 1 - for i = 1, udp_node_num, 1 do - if (ucic:get(appname, "@global[0]", "udp_node" .. i) or "nil") == "tcp" then - e["udp_node%s_status" % i] = e["tcp_node%s_status" % i] - else - e["udp_node%s_status" % i] = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep -i 'UDP_%s' >/dev/null", appname, i)) == 0 - end + if (ucic:get(appname, "@global[0]", "udp_node") or "nil") == "tcp" then + e["udp_node_status"] = e["tcp_node_status"] + else + e["udp_node_status"] = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep -i 'UDP' >/dev/null", appname)) == 0 end luci.http.prepare_content("application/json") luci.http.write_json(e) @@ -255,9 +240,8 @@ end function set_node() local protocol = luci.http.formvalue("protocol") - local number = luci.http.formvalue("number") local section = luci.http.formvalue("section") - ucic:set(appname, "@global[0]", protocol .. "_node" .. number, section) + ucic:set(appname, "@global[0]", protocol .. "_node", section) ucic:commit(appname) luci.sys.call("/etc/init.d/passwall restart > /dev/null 2>&1 &") luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "log")) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_xray.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_xray.lua index 7759a0a7c0..63d823a3ab 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_xray.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_xray.lua @@ -155,6 +155,7 @@ function gen_outbound(node, tag, relay_port) address = node.address, port = tonumber(node.port), method = node.method or nil, + flow = node.flow or nil, password = node.password or "", users = (node.username and node.password) and {{user = node.username, pass = node.password}} or nil diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua index 78fc29f06c..d700d457d2 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua @@ -40,20 +40,6 @@ o = s:option(Value, "mac", translate("MAC")) o.rmempty = true sys.net.mac_hints(function(e, t) o:value(e, "%s (%s)" % {e, t}) end) ----- TCP Node -local tcp_node_num = m:get("@global_other[0]", "tcp_node_num") or 1 -if tonumber(tcp_node_num) > 1 then - o = s:option(ListValue, "tcp_node", translate("TCP Node")) - for i = 1, tcp_node_num, 1 do o:value(i, "TCP_" .. i) end -end - ----- UDP Node -local udp_node_num = m:get("@global_other[0]", "udp_node_num") or 1 -if tonumber(udp_node_num) > 1 then - o = s:option(ListValue, "udp_node", translate("UDP Node")) - for i = 1, udp_node_num, 1 do o:value(i, "UDP_" .. i) end -end - ---- TCP Proxy Mode o = s:option(ListValue, "tcp_proxy_mode", "TCP" .. translate("Proxy Mode")) o.default = "default" diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua index e9baecd5ec..e17aa025d8 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua @@ -25,22 +25,16 @@ o.rmempty = false o = s:option(Value, "testing_time", translate("How often is a diagnosis made"), translate("Units:minutes")) o.default = "3" ----- TCP Node --- local tcp_node_num = tonumber(m:get("@global_other[0]", "tcp_node_num") or 1) --- 暂时只支持TCP1 -local tcp_node_num = 1 -for i = 1, tcp_node_num, 1 do - o = s:option(ListValue, "tcp_main" .. i, "TCP " .. i .. " " .. translate("Main node")) - for k, v in pairs(nodes_table) do - o:value(v.id, v.remarks) - end +o = s:option(ListValue, "tcp_main", "TCP " .. translate("Main node")) +for k, v in pairs(nodes_table) do + o:value(v.id, v.remarks) +end - o = s:option(DynamicList, "tcp_node" .. i, "TCP " .. i .. " " .. translate("List of backup nodes")) - for k, v in pairs(nodes_table) do - o:value(v.id, v.remarks) - end - - o = s:option(Flag, "restore_switch" .. i, "TCP " .. i .. " " .. translate("Restore Switch"), translate("When detects main node is available, switch back to the main node.")) +o = s:option(DynamicList, "tcp_node", "TCP " .. translate("List of backup nodes")) +for k, v in pairs(nodes_table) do + o:value(v.id, v.remarks) end +o = s:option(Flag, "restore_switch", "TCP " .. translate("Restore Switch"), translate("When detects main node is available, switch back to the main node.")) + return m diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index 27990677d6..24236c0d61 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -74,62 +74,51 @@ o = s:taboption("Main", Flag, "enabled", translate("Main switch")) o.rmempty = false ---- TCP Node -local tcp_node_num = tonumber(m:get("@global_other[0]", "tcp_node_num") or 1) -for i = 1, tcp_node_num, 1 do - o = s:taboption("Main", ListValue, "tcp_node" .. i, translate("TCP Node") .. " " .. i) - if i == 1 then - o.title = translate("TCP Node") - o.description = "" - --o.description = translate("For proxy specific list.") - --o.description = o.description .. "
" - local current_node = luci.sys.exec(string.format("[ -f '/var/etc/%s/id/TCP_%s' ] && echo -n $(cat /var/etc/%s/id/TCP_%s)", appname, i, appname, i)) - if current_node and current_node ~= "" and current_node ~= "nil" then - local n = uci:get_all(appname, current_node) - if n then - if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then - local remarks = api.get_full_node_remarks(n) - local url = d.build_url("admin", "services", appname, "node_config", current_node) - o.description = o.description .. translatef("Current node: %s", string.format('%s', url, remarks)) .. "
" - end - if n.protocol and n.protocol == "_shunt" then - uci:foreach(appname, "shunt_rules", function(e) - local id = e[".name"] - local remarks = translate(e.remarks) - if n[id] and n[id] ~= "nil" then - local url = d.build_url("admin", "services", appname, "node_config", n[id]) - local r = api.get_full_node_remarks(uci:get_all(appname, n[id])) - o.description = o.description .. remarks .. ":" .. string.format('%s', url, r) .. "
" - end - end) - local id = "default_node" - local remarks = translate("Default") - if n[id] and n[id] ~= "nil" then - local url = d.build_url("admin", "services", appname, "node_config", n[id]) - local r = api.get_full_node_remarks(uci:get_all(appname, n[id])) - o.description = o.description .. remarks .. ":" .. string.format('%s', url, r) .. "
" - end +o = s:taboption("Main", ListValue, "tcp_node", translate("TCP Node")) +o.title = translate("TCP Node") +o.description = "" +--o.description = translate("For proxy specific list.") +--o.description = o.description .. "
" +local current_node = luci.sys.exec(string.format("[ -f '/var/etc/%s/id/TCP' ] && echo -n $(cat /var/etc/%s/id/TCP)", appname, appname)) +if current_node and current_node ~= "" and current_node ~= "nil" then + local n = uci:get_all(appname, current_node) + if n then + if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then + local remarks = api.get_full_node_remarks(n) + local url = d.build_url("admin", "services", appname, "node_config", current_node) + o.description = o.description .. translatef("Current node: %s", string.format('%s', url, remarks)) .. "
" + end + if n.protocol and n.protocol == "_shunt" then + uci:foreach(appname, "shunt_rules", function(e) + local id = e[".name"] + local remarks = translate(e.remarks) + if n[id] and n[id] ~= "nil" then + local url = d.build_url("admin", "services", appname, "node_config", n[id]) + local r = api.get_full_node_remarks(uci:get_all(appname, n[id])) + o.description = o.description .. remarks .. ":" .. string.format('%s', url, r) .. "
" end + end) + local id = "default_node" + local remarks = translate("Default") + if n[id] and n[id] ~= "nil" then + local url = d.build_url("admin", "services", appname, "node_config", n[id]) + local r = api.get_full_node_remarks(uci:get_all(appname, n[id])) + o.description = o.description .. remarks .. ":" .. string.format('%s', url, r) .. "
" end end end - o:value("nil", translate("Close")) - for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end end +o:value("nil", translate("Close")) +for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end ----- UDP Node -local udp_node_num = tonumber(m:get("@global_other[0]", "udp_node_num") or 1) -for i = 1, udp_node_num, 1 do - o = s:taboption("Main", ListValue, "udp_node" .. i, translate("UDP Node") .. " " .. i) - o:value("nil", translate("Close")) - if i == 1 then - o.title = translate("UDP Node") - --o.description = translate("For proxy game network, DNS hijack etc.") .. "
" .. translate("The selected server will not use Kcptun.") - o:value("tcp_", translate("Same as the tcp node")) - --o:value("tcp", translate("Same as the tcp node")) - --o:value("tcp_", translate("Same as the tcp node") .. "(" .. translate("New process") .. ")") - end - for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end -end +o = s:taboption("Main", ListValue, "udp_node", translate("UDP Node")) +o:value("nil", translate("Close")) +o.title = translate("UDP Node") +--o.description = translate("For proxy game network, DNS hijack etc.") .. "
" .. translate("The selected server will not use Kcptun.") +o:value("tcp_", translate("Same as the tcp node")) +--o:value("tcp", translate("Same as the tcp node")) +--o:value("tcp_", translate("Same as the tcp node") .. "(" .. translate("New process") .. ")") +for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end s:tab("DNS", translate("DNS")) @@ -306,14 +295,12 @@ o.default = "default" o.rmempty = false s:tab("log", translate("Log")) -for i = 1, tcp_node_num, 1 do - o = s:taboption("log", Flag, "close_log_tcp_" .. i , translate("Close") .. translate("Log") .. " " .. translate("TCP Node") .. " " .. i) - o.rmempty = false -end -for i = 1, udp_node_num, 1 do - o = s:taboption("log", Flag, "close_log_udp_" .. i, translate("Close") .. translate("Log") .. " " .. translate("UDP Node") .. " " .. i) - o.rmempty = false -end +o = s:taboption("log", Flag, "close_log_tcp", translate("Close") .. translate("Log") .. " " .. translate("TCP Node")) +o.rmempty = false + +o = s:taboption("log", Flag, "close_log_udp", translate("Close") .. translate("Log") .. " " .. translate("UDP Node")) +o.rmempty = false + loglevel = s:taboption("log", ListValue, "loglevel", "X/V2ray" .. translate("Log Level")) loglevel.default = "warning" loglevel:value("debug") @@ -355,10 +342,7 @@ o.default = 1 o.rmempty = false o = s:option(ListValue, "node", translate("Socks Node")) -local tcp_node_num = tonumber(m:get("@global_other[0]", "tcp_node_num") or 1) -for i = 1, tcp_node_num, 1 do - o:value("tcp" .. i, translatef("Same as the tcp %s node", i)) -end +o:value("tcp", translate("Same as the tcp node")) for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end o = s:option(Value, "port", "Socks" .. translate("Listen Port")) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua index 02c785f935..f11d3f3cf1 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua @@ -454,8 +454,10 @@ tls:depends("type", "Trojan-Go") xtls = s:option(Flag, "xtls", translate("XTLS")) xtls.default = 0 xtls:depends({ type = "Xray", protocol = "vless", tls = "1" }) +xtls:depends({ type = "Xray", protocol = "trojan", tls = "1" }) flow = s:option(Value, "flow", translate("flow")) +flow.default = "xtls-rprx-direct" flow:value("xtls-rprx-origin") flow:value("xtls-rprx-origin-udp443") flow:value("xtls-rprx-direct") diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index e9eddc103b..d7efef2c21 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -121,29 +121,10 @@ o.rmempty = true --]] -- [[ Other Settings ]]-- -s = m:section(TypedSection, "global_other", translate("Other Settings"), - "" .. translatef( - "You can only set up a maximum of %s nodes for the time being, Used for access control.", - "3") .. "") +s = m:section(TypedSection, "global_other", translate("Other Settings")) s.anonymous = true s.addremove = false ----- TCP Node Number Option -o = s:option(ListValue, "tcp_node_num", "TCP" .. translate("Node Number")) -o.default = "1" -o.rmempty = false -o:value("1") -o:value("2") -o:value("3") - ----- UDP Node Number Option -o = s:option(ListValue, "udp_node_num", "UDP" .. translate("Node Number")) -o.default = "1" -o.rmempty = false -o:value("1") -o:value("2") -o:value("3") - o = s:option(MultiValue, "status", translate("Status info")) o:value("big_icon", translate("Big icon")) -- 大图标 o:value("show_check_port", translate("Show node check")) -- 显示节点检测 diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua index bf95912e54..d6bb806ea9 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua @@ -17,7 +17,7 @@ s:tab("proxy_list3", translate("Proxy List") .. " 3") ---- Direct Hosts local direct_host = string.format("/usr/share/%s/rules/direct_host", appname) -o = s:taboption("direct_list", TextValue, "direct_hosts", "", "" .. translate("Join the direct hosts list of domain names will not proxy.") .. "") +o = s:taboption("direct_list", TextValue, "direct_host", "", "" .. translate("Join the direct hosts list of domain names will not proxy.") .. "") o.rows = 15 o.wrap = "off" o.cfgvalue = function(self, section) return fs.readfile(direct_host) or "" end @@ -91,80 +91,4 @@ o.validate = function(self, value) return value end ----- Proxy Hosts 2 -local proxy_host2 = string.format("/usr/share/%s/rules/proxy_host2", appname) -o = s:taboption("proxy_list2", TextValue, "proxy_host2", "", "" .. translate("These had been joined websites will use proxy. Please input the domain names of websites,every line can input only one website domain. For example: google.com.") .. "") -o.rows = 15 -o.wrap = "off" -o.cfgvalue = function(self, section) return fs.readfile(proxy_host2) or "" end -o.write = function(self, section, value) fs.writefile(proxy_host2, value:gsub("\r\n", "\n")) end -o.remove = function(self, section, value) fs.writefile(proxy_host2, "") end -o.validate = function(self, value) - local hosts= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(hosts, w) end) - for index, host in ipairs(hosts) do - if not datatypes.hostname(host) then - return nil, host .. " " .. translate("Not valid domain name, please re-enter!") - end - end - return value -end - ----- Proxy IP 2 -local proxy_ip2 = string.format("/usr/share/%s/rules/proxy_ip2", appname) -o = s:taboption("proxy_list2", TextValue, "blacklist_ip2", "", "" .. translate("These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example: 35.24.0.0/24 or 8.8.4.4.") .. "") -o.rows = 15 -o.wrap = "off" -o.cfgvalue = function(self, section) return fs.readfile(proxy_ip2) or "" end -o.write = function(self, section, value) fs.writefile(proxy_ip2, value:gsub("\r\n", "\n")) end -o.remove = function(self, section, value) fs.writefile(proxy_ip2, "") end -o.validate = function(self, value) - local ipmasks= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(ipmasks, w) end) - for index, ipmask in ipairs(ipmasks) do - if not datatypes.ipmask4(ipmask) then - return nil, ipmask .. " " .. translate("Not valid IP format, please re-enter!") - end - end - return value -end - ----- Proxy Hosts 3 -local proxy_host3 = string.format("/usr/share/%s/rules/proxy_host3", appname) -o = s:taboption("proxy_list3", TextValue, "proxy_host3", "", "" .. translate("These had been joined websites will use proxy. Please input the domain names of websites,every line can input only one website domain. For example: google.com.") .. "") -o.rows = 15 -o.wrap = "off" -o.cfgvalue = function(self, section) return fs.readfile(proxy_host3) or "" end -o.write = function(self, section, value) fs.writefile(proxy_host3, value:gsub("\r\n", "\n")) end -o.remove = function(self, section, value) fs.writefile(proxy_host3, "") end -o.validate = function(self, value) - local hosts= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(hosts, w) end) - for index, host in ipairs(hosts) do - if not datatypes.hostname(host) then - return nil, host .. " " .. translate("Not valid domain name, please re-enter!") - end - end - return value -end - ----- Proxy IP 3 -local proxy_ip3 = string.format("/usr/share/%s/rules/proxy_ip3", appname) -o = s:taboption("proxy_list3", TextValue, "blacklist_ip3", "", "" .. translate("These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example: 35.24.0.0/24 or 8.8.4.4.") .. "") -o.rows = 15 -o.wrap = "off" -o.cfgvalue = function(self, section) return fs.readfile(proxy_ip3) or "" end -o.write = function(self, section, value) fs.writefile(proxy_ip3, value:gsub("\r\n", "\n")) end -o.remove = function(self, section, value) fs.writefile(proxy_ip3, "") end -o.validate = function(self, value) - local ipmasks= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(ipmasks, w) end) - for index, ipmask in ipairs(ipmasks) do - if not datatypes.ipmask4(ipmask) then - return nil, ipmask .. " " .. translate("Not valid IP format, please re-enter!") - end - end - return value -end - return m diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/xray.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/xray.lua index 4d38285ebf..9c155db14f 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/xray.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/xray.lua @@ -58,6 +58,7 @@ function gen_config(user) local clients = {} for i = 1, #user.uuid do clients[i] = { + flow = (user.xtls and user.xtls == "1") and user.flow or nil, password = user.uuid[i], level = tonumber(user.level) } @@ -77,6 +78,31 @@ function gen_config(user) } end + if user.fallback and user.fallback == "1" then + local fallbacks = {} + for i = 1, #user.fallback_list do + local fallbackStr = user.fallback_list[i] + if fallbackStr then + local tmp = {} + string.gsub(fallbackStr, '[^' .. "," .. ']+', function(w) + table.insert(tmp, w) + end) + local dest = tmp[1] or "" + local path = tmp[2] + if dest:find("%.") then + else + dest = tonumber(dest) + end + fallbacks[i] = { + path = path, + dest = dest, + xver = 1 + } + end + end + settings.fallbacks = fallbacks + end + routing = { domainStrategy = "IPOnDemand", rules = { @@ -110,7 +136,7 @@ function gen_config(user) network = user.transport, security = "none", xtlsSettings = (user.tls and user.tls == "1" and user.xtls and user.xtls == "1") and { - --alpn = {"http/1.1"}, + alpn = {"http/1.1"}, disableSystemRoot = false, certificates = { { @@ -120,6 +146,7 @@ function gen_config(user) } } or nil, tlsSettings = (user.tls and user.tls == "1") and { + alpn = {"http/1.1"}, disableSystemRoot = false, certificates = { { @@ -151,7 +178,7 @@ function gen_config(user) header = {type = user.mkcp_guise} } or nil, wsSettings = (user.transport == "ws") and { - acceptProxyProtocol = false, + acceptProxyProtocol = true, headers = (user.ws_host) and {Host = user.ws_host} or nil, path = user.ws_path } or nil, diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua index 8d9c6212e8..2efd15eb86 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua @@ -297,6 +297,7 @@ tls:depends({ type = "Xray", protocol = "vmess" }) tls:depends({ type = "Xray", protocol = "vless" }) tls:depends({ type = "Xray", protocol = "socks" }) tls:depends({ type = "Xray", protocol = "shadowsocks" }) +tls:depends({ type = "Xray", protocol = "trojan" }) tls:depends({ type = "V2ray", protocol = "vmess" }) tls:depends({ type = "V2ray", protocol = "vless" }) tls:depends({ type = "V2ray", protocol = "socks" }) @@ -308,15 +309,14 @@ tls:depends("type", "Trojan-Go") xtls = s:option(Flag, "xtls", translate("XTLS")) xtls.default = 0 xtls:depends({ type = "Xray", protocol = "vless", tls = "1" }) +xtls:depends({ type = "Xray", protocol = "trojan", tls = "1" }) flow = s:option(Value, "flow", translate("flow")) -flow.default = "xtls-rprx-origin" +flow.default = "xtls-rprx-direct" flow:value("xtls-rprx-origin") flow:value("xtls-rprx-origin-udp443") flow:value("xtls-rprx-direct") flow:value("xtls-rprx-direct-udp443") -flow:value("xtls-rprx-splice") -flow:value("xtls-rprx-splice-udp443") flow:depends("xtls", "1") -- [[ TLS部分 ]] -- @@ -330,7 +330,7 @@ tls_allowInsecure:depends({ type = "Trojan-Go", tls = "1" }) tls_serverName = s:option(Value, "tls_serverName", translate("Domain")) tls_serverName:depends("tls", "1") -tls_certificateFile = s:option(Value, "tls_certificateFile", translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +tls_certificateFile = s:option(FileUpload, "tls_certificateFile", translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") tls_certificateFile.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -341,9 +341,10 @@ tls_certificateFile.validate = function(self, value, t) end return nil end +tls_certificateFile.default = "/etc/config/ssl/" .. arg[1] .. ".pem" tls_certificateFile:depends("tls", "1") -tls_keyFile = s:option(Value, "tls_keyFile", translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +tls_keyFile = s:option(FileUpload, "tls_keyFile", translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") tls_keyFile.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -354,6 +355,7 @@ tls_keyFile.validate = function(self, value, t) end return nil end +tls_keyFile.default = "/etc/config/ssl/" .. arg[1] .. ".key" tls_keyFile:depends("tls", "1") tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket")) @@ -509,12 +511,14 @@ quic_guise = s:option(ListValue, "quic_guise", translate("Camouflage Type")) for a, t in ipairs(header_type_list) do quic_guise:value(t) end quic_guise:depends("transport", "quic") --- [[ VLESS Fallback部分 ]]-- ---[[ +-- [[ Fallback部分 ]]-- fallback = s:option(Flag, "fallback", translate("Fallback")) -fallback:depends({ type = "Xray", protocol = "vless", transport = "tcp", tls = "1" }) -fallback:depends({ type = "V2ray", protocol = "vless", transport = "tcp", tls = "1" }) +fallback:depends({ type = "Xray", protocol = "vless", transport = "tcp" }) +fallback:depends({ type = "Xray", protocol = "trojan", transport = "tcp" }) +fallback:depends({ type = "V2ray", protocol = "vless", transport = "tcp" }) +fallback:depends({ type = "V2ray", protocol = "trojan", transport = "tcp" }) +--[[ fallback_alpn = s:option(Value, "fallback_alpn", "Fallback alpn") fallback_alpn:depends("fallback", "1") @@ -529,6 +533,9 @@ fallback_xver.default = 0 fallback_xver:depends("fallback", "1") ]]-- +fallback_list = s:option(DynamicList, "fallback_list", "Fallback", translate("dest,path")) +fallback_list:depends("fallback", "1") + ss_aead = s:option(Flag, "ss_aead", translate("Shadowsocks2")) ss_aead:depends("type", "Trojan-Go") ss_aead.default = "0" diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/footer.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/footer.htm index dacce36afa..8e033c92aa 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/footer.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/footer.htm @@ -1,7 +1,5 @@ <% local api = require "luci.model.cbi.passwall.api.api" -local tcp_node_num = api.uci_get_type("global_other", "tcp_node_num", 1) -local udp_node_num = api.uci_get_type("global_other", "udp_node_num", 1) local auto_switch = api.uci_get_type("auto_switch", "enable", 0) -%>