Merge Mainline

This commit is contained in:
AmadeusGhost 2020-05-10 11:39:25 +08:00
commit c5ac0034f8
53 changed files with 10354 additions and 398 deletions

View File

@ -0,0 +1,41 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2020.04
PKG_RELEASE:=1
PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
include $(INCLUDE_DIR)/u-boot.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
define U-Boot/Default
BUILD_TARGET:=mediatek
UBOOT_IMAGE:=u-boot-mtk.bin
DEFAULT:=y
endef
define U-Boot/mt7629
NAME:=MT7629
BUILD_SUBTARGET:=mt7629
UBOOT_CONFIG:=mt7629_rfb
endef
define U-Boot/mt7622
NAME:=MT7622
BUILD_SUBTARGET:=mt7622
UBOOT_CONFIG:=mt7622_rfb
endef
UBOOT_TARGETS := mt7629 mt7622
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE)
Build/Exports:=$(Host/Exports)
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE)
endef
$(eval $(call BuildPackage/U-Boot))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
From b1b3c3d2ce62872c8dec4a7d645af6b3c565e094 Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
Date: Mon, 20 Apr 2020 17:11:32 +0800
Subject: [PATCH 2/3] mt7622 uboot: add dts and config for spi nand
This patch add dts and config for mt7622 spi nand
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
---
arch/arm/dts/mt7622-rfb.dts | 6 ++++++
arch/arm/dts/mt7622.dtsi | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/arch/arm/dts/mt7622-rfb.dts b/arch/arm/dts/mt7622-rfb.dts
index f05c3fe14d..05502bddec 100644
--- a/arch/arm/dts/mt7622-rfb.dts
+++ b/arch/arm/dts/mt7622-rfb.dts
@@ -143,6 +143,12 @@
};
};
+&nandc {
+ pinctrl-names = "default";
+ pinctrl-0 = <&snfi_pins>;
+ status = "okay";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
diff --git a/arch/arm/dts/mt7622.dtsi b/arch/arm/dts/mt7622.dtsi
index 1e8ec9b48b..63fdb63d4a 100644
--- a/arch/arm/dts/mt7622.dtsi
+++ b/arch/arm/dts/mt7622.dtsi
@@ -52,6 +52,26 @@
#size-cells = <0>;
};
+ nandc: nfi@1100d000 {
+ compatible = "mediatek,mt7622-nfc";
+ reg = <0x1100d000 0x1000>,
+ <0x1100e000 0x1000>;
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>,
+ <GIC_SPI 95 IRQ_TYPE_LEVEL_LOW>;
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
+ <&pericfg CLK_PERI_NFIECC_PD>,
+ <&pericfg CLK_PERI_SNFI_PD>,
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>,
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
+ clock-names = "nfi_clk",
+ "ecc_clk",
+ "snfi_clk",
+ "spinfi_sel",
+ "spinfi_parent_50m";
+ nand-ecc-mode = "hw";
+ status = "disabled";
+ };
+
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <&gic>;
--
2.17.1

View File

@ -0,0 +1,38 @@
From e5745143a2984cf44fbfc0b3aedb49e57873f109 Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
Date: Mon, 20 Apr 2020 17:17:04 +0800
Subject: [PATCH 3/3] configs: enable mtd and mtk_spi_nand in defconfig
This patch enable mtk and mtk_spi_nand in mt7622_rfb defconfig
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
---
configs/mt7622_rfb_defconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configs/mt7622_rfb_defconfig b/configs/mt7622_rfb_defconfig
index 1ce6ebdfeb..816126267b 100644
--- a/configs/mt7622_rfb_defconfig
+++ b/configs/mt7622_rfb_defconfig
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_FDT_FILE="mt7622-rfb"
CONFIG_SYS_PROMPT="MT7622> "
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_MMC=y
+CONFIG_CMD_NAND=y
CONFIG_CMD_SF_TEST=y
CONFIG_CMD_PING=y
CONFIG_CMD_SMC=y
@@ -25,6 +26,10 @@ CONFIG_CLK=y
CONFIG_DM_MMC=y
CONFIG_MMC_HS200_SUPPORT=y
CONFIG_MMC_MTK=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTK_SPI_NAND=y
+CONFIG_MTD_RAW_NAND=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH_EON=y
CONFIG_SPI_FLASH_GIGADEVICE=y
--
2.17.1

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-frps
PKG_VERSION:=0.0.2
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

View File

@ -7,19 +7,5 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF
frps=$(uci -q get frps.@frps[-1])
if [ -z "$frps" ]; then
uci -q add frps frps
fi
if [ "x$frps" != "xmain" ]; then
uci -q batch <<-EOF >/dev/null
rename frps.@frps[-1]="main"
set frps.main.enabled="0"
commit frps
EOF
fi
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
exit 0

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.37.6
PKG_VERSION:=0.38.1
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -35,6 +35,12 @@ define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/proxy_provider >/dev/null 2>&1
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/backup >/dev/null 2>&1
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/core >/dev/null 2>&1
mkdir -p $(PKG_BUILD_DIR)/files/usr/share/openclash/backup >/dev/null 2>&1
cp "$(PKG_BUILD_DIR)/files/etc/config/openclash" "$(PKG_BUILD_DIR)/files/usr/share/openclash/backup/openclash" >/dev/null 2>&1
cp "$(PKG_BUILD_DIR)/files/etc/openclash/custom/openclash_custom_rules.list" "$(PKG_BUILD_DIR)/files/usr/share/openclash/backup/openclash_custom_rules.list" >/dev/null 2>&1
cp "$(PKG_BUILD_DIR)/files/etc/openclash/custom/openclash_custom_rules_2.list" "$(PKG_BUILD_DIR)/files/usr/share/openclash/backup/openclash_custom_rules_2.list" >/dev/null 2>&1
cp "$(PKG_BUILD_DIR)/files/etc/openclash/custom/openclash_custom_hosts.list" "$(PKG_BUILD_DIR)/files/usr/share/openclash/backup/openclash_custom_hosts.list" >/dev/null 2>&1
cp "$(PKG_BUILD_DIR)/files/etc/openclash/custom/openclash_custom_fake_filter.list" "$(PKG_BUILD_DIR)/files/usr/share/openclash/backup/openclash_custom_fake_filter.list" >/dev/null 2>&1
endef
define Build/Configure
@ -50,14 +56,14 @@ if [ -f "/etc/config/openclash" ]; then
cp "/etc/config/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_rules_2.list" "/tmp/openclash_custom_rules_2.list.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_fake_filter.list" "/tmp/openclash_custom_fake_filter.list.bak" >/dev/null 2>&1
cp "/etc/openclash/history" "/tmp/openclash_history.bak" >/dev/null 2>&1
fi
if [ -f "/etc/openclash/custom/openclash_custom_rules.list" ]; then
cp "/etc/openclash/custom/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_rules_2.list" "/tmp/openclash_custom_rules_2.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_fake_filter.list" "/tmp/openclash_custom_fake_filter.list.bak" >/dev/null 2>&1
fi
endef
@ -83,14 +89,14 @@ cp "/etc/config/openclash" "/usr/share/openclash/backup/openclash" >/dev/null 2>
cp "/etc/openclash/custom/openclash_custom_rules.list" "/usr/share/openclash/backup/openclash_custom_rules.list" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_rules_2.list" "/usr/share/openclash/backup/openclash_custom_rules_2.list" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_hosts.list" "/usr/share/openclash/backup/openclash_custom_hosts.list" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_fake_black.conf" "/usr/share/openclash/backup/openclash_custom_fake_black.conf" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_fake_filter.list" "/usr/share/openclash/backup/openclash_custom_fake_filter.list" >/dev/null 2>&1
if [ -f "/tmp/openclash.bak" ]; then
mv "/tmp/openclash.bak" "/etc/config/openclash" >/dev/null 2>&1
mv "/tmp/openclash_custom_rules.list.bak" "/etc/openclash/custom/openclash_custom_rules.list" >/dev/null 2>&1
mv "/tmp/openclash_custom_rules_2.list.bak" "/etc/openclash/custom/openclash_custom_rules_2.list" >/dev/null 2>&1
mv "/tmp/openclash_custom_hosts.list.bak" "/etc/openclash/custom/openclash_custom_hosts.list" >/dev/null 2>&1
mv "/tmp/openclash_custom_fake_black.conf.bak" "/etc/openclash/custom/openclash_custom_fake_black.conf" >/dev/null 2>&1
mv "/tmp/openclash_custom_fake_filter.list.bak" "/etc/openclash/custom/openclash_custom_fake_filter.list" >/dev/null 2>&1
mv "/tmp/openclash_history.bak" "/etc/openclash/history" >/dev/null 2>&1
fi
if [ -f "/tmp/config.yaml" ]; then
@ -145,11 +151,11 @@ define Package/$(PKG_NAME)/prerm
cp "/etc/config/openclash" "/tmp/openclash.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
cp "/etc/config/openclash_custom_fake_filter.list" "/tmp/openclash_custom_fake_filter.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_rules_2.list" "/tmp/openclash_custom_rules_2.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
cp "/etc/openclash/custom/openclash_custom_fake_filter.list" "/tmp/openclash_custom_fake_filter.list.bak" >/dev/null 2>&1
endef
define Package/$(PKG_NAME)/postrm

View File

@ -29,9 +29,6 @@ add_cron()
[ -z "$(grep "openclash.sh" "$CRON_FILE" 2>/dev/null)" ] && {
[ "$(uci get openclash.config.auto_update 2>/dev/null)" -eq 1 ] && [ "$(uci get openclash.config.config_auto_update_mode 2>/dev/null)" -ne 1 ] && echo "0 $(uci get openclash.config.auto_update_time 2>/dev/null) * * $(uci get openclash.config.config_update_week_time 2>/dev/null) /usr/share/openclash/openclash.sh" >> $CRON_FILE
}
[ -z "$(grep "openclash.sh" "$CRON_FILE" 2>/dev/null)" ] && {
[ "$(uci get openclash.config.auto_update 2>/dev/null)" -eq 1 ] && [ "$(uci get openclash.config.config_auto_update_mode 2>/dev/null)" -eq 1 ] && echo "*/$(uci get openclash.config.config_update_interval 2>/dev/null) * * * * /usr/share/openclash/openclash.sh" >> $CRON_FILE
}
[ -z "$(grep "openclash_rule.sh" "$CRON_FILE" 2>/dev/null)" ] && {
[ "$(uci get openclash.config.other_rule_auto_update 2>/dev/null)" -eq 1 ] && echo "0 $(uci get openclash.config.other_rule_update_day_time 2>/dev/null) * * $(uci get openclash.config.other_rule_update_week_time 2>/dev/null) /usr/share/openclash/openclash_rule.sh" >> $CRON_FILE
}
@ -73,12 +70,11 @@ change_dns() {
revert_dns() {
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$3" >/dev/null 2>&1
[ "$1" = "1" ] && {
[ -s "/tmp/resolv.conf.d/resolv.conf.auto" ] && {
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto >/dev/null 2>&1
}
[ -s "/tmp/resolv.conf.auto" ] && {
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
}
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto >/dev/null 2>&1
elif [ -s "/tmp/resolv.conf.auto" ]; then
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
fi
uci set dhcp.@dnsmasq[0].noresolv=0 >/dev/null 2>&1
}
[ "$2" = "1" ] && {
@ -88,22 +84,6 @@ revert_dns() {
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
}
fake_block() {
if [ "$1" = "fake-ip" ]; then
if [ ! -f /etc/openclash/dnsmasq_fake_block.conf ]; then
/usr/share/openclash/openclash_fake_block.sh
elif [ "$(awk -F '/' '{print $3}' /etc/openclash/dnsmasq_fake_block.conf |head -1)" != "114.114.114.114" ] && [ -z "$2" ]; then
/usr/share/openclash/openclash_fake_block.sh
elif [ "$(awk -F '/' '{print $3}' /etc/openclash/dnsmasq_fake_block.conf |head -1)" != "$2" ] && [ ! -z "$2" ]; then
/usr/share/openclash/openclash_fake_block.sh
elif [ ! -z "$(grep "config servers" /etc/config/openclash)" ] && [ -z "$(grep -F '#Server Nodes' /etc/openclash/dnsmasq_fake_block.conf)" ]; then
/usr/share/openclash/openclash_fake_block.sh
fi
mkdir -p /tmp/dnsmasq.d
ln -s /etc/openclash/dnsmasq_fake_block.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
fi
}
yml_check()
{
#格式替换
@ -762,87 +742,10 @@ if [ "$operation_mode" = "redir-host" ] && [ "$en_mode" = "redir-host" ]; then
config_list_foreach "config" "lan_ac_white_ips" lan_ac "lan_ac_white_ips"
fi
fi
if [ -z "$en_mode_tun" ]; then
#tcp
iptables -t nat -N openclash
iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -d 0.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 10.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 127.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 169.254.0.0/16 -j RETURN
iptables -t nat -A openclash -d 172.16.0.0/12 -j RETURN
iptables -t nat -A openclash -d 192.168.0.0/16 -j RETURN
iptables -t nat -A openclash -d 224.0.0.0/4 -j RETURN
iptables -t nat -A openclash -d 240.0.0.0/4 -j RETURN
if [ ! -z "$wan_ip4" ]; then
for wan_ip4s in $wan_ip4; do
iptables -t nat -A openclash -d "$wan_ip4s" -j RETURN 2>/dev/null
done
fi
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
#iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j REDIRECT --to-ports "$proxy_port"
#iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A PREROUTING -p tcp -j openclash
#udp
if [ "$enable_udp_proxy" -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"
iptables -t mangle -N openclash
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -d 0.0.0.0/8 -j RETURN
iptables -t mangle -A openclash -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A openclash -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A openclash -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A openclash -d 172.16.0.0/12 -j RETURN
iptables -t mangle -A openclash -d 192.168.0.0/16 -j RETURN
iptables -t mangle -A openclash -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A openclash -d 240.0.0.0/4 -j RETURN
if [ ! -z "$wan_ip4" ]; then
for wan_ip4s in $wan_ip4; do
iptables -t mangle -A openclash -d "$wan_ip4s" -j RETURN 2>/dev/null
done
fi
iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$proxy_port" --on-ip 0.0.0.0 --tproxy-mark "$PROXY_FWMARK"
iptables -t mangle -A PREROUTING -p udp -j openclash
fi
if [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi
if [ "$ipv6_enable" -eq 1 ]; then
#tcp
ip6tables -t nat -N openclash
if [ ! -z "$lan_ip6" ]; then
for lan_ip6s in $lan_ip6; do
ip6tables -t nat -A openclash -d "$lan_ip6s" -j RETURN 2>/dev/null
done
fi
ip6tables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
ip6tables -t nat -A PREROUTING -p tcp -j openclash
#udp
if [ "$enable_udp_proxy" -eq 1 ]; then
ip6tables -t mangle -N openclash
if [ ! -z "$lan_ip6" ]; then
for lan_ip6s in $lan_ip6; do
if [ "$enable_udp_proxy" -eq 1 ]; then
ip6tables -t mangle -A openclash -d "$lan_ip6s" -j RETURN 2>/dev/null
fi
done
fi
ip6tables -t mangle -A openclash -p udp -j TPROXY --on-port "$proxy_port" --on-ip 0.0.0.0 --tproxy-mark "$PROXY_FWMARK"
ip6tables -t mangle -A PREROUTING -p udp -j openclash
fi
fi
else
#TUN模式
#local
ipset create localnetwork hash:net
ipset add localnetwork 0.0.0.0/8
ipset add localnetwork 127.0.0.0/8
ipset add localnetwork 10.0.0.0/8
ipset add localnetwork 169.254.0.0/16
@ -856,6 +759,66 @@ else
ipset add localnetwork "$wan_ip4s" 2>/dev/null
done
fi
if [ -z "$en_mode_tun" ]; then
#tcp
iptables -t nat -N openclash
iptables -t nat -F openclash
iptables -t nat -A openclash -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A PREROUTING -p tcp -j openclash
#udp
if [ "$enable_udp_proxy" -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"
iptables -t mangle -N openclash
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$proxy_port" --on-ip 0.0.0.0 --tproxy-mark "$PROXY_FWMARK"
iptables -t mangle -A PREROUTING -p udp -j openclash
fi
if [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -N openclash_output
iptables -t nat -F openclash_output
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A OUTPUT -p tcp -j openclash_output
fi
if [ "$ipv6_enable" -eq 1 ]; then
#tcp
ip6tables -t nat -N openclash
if [ ! -z "$lan_ip6" ]; then
for lan_ip6s in $lan_ip6; do
ip6tables -t nat -A openclash -d "$lan_ip6s" -j RETURN 2>/dev/null
done
fi
ip6tables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
ip6tables -t nat -A PREROUTING -p tcp -j openclash
#udp
#if [ "$enable_udp_proxy" -eq 1 ]; then
# ip6tables -t mangle -N openclash
# if [ ! -z "$lan_ip6" ]; then
# for lan_ip6s in $lan_ip6; do
# if [ "$enable_udp_proxy" -eq 1 ]; then
# ip6tables -t mangle -A openclash -d "$lan_ip6s" -j RETURN 2>/dev/null
# fi
# done
# fi
# ip6tables -t mangle -A openclash -p udp -j TPROXY --on-port "$proxy_port" --tproxy-mark "$PROXY_FWMARK"
# ip6tables -t mangle -A PREROUTING -p udp -j openclash
#fi
fi
else
#TUN模式
#启动TUN
if [ "$en_mode_tun" = "2" ]; then
ip tuntap add user root mode tun clash0
@ -879,9 +842,9 @@ else
iptables -t mangle -A openclash -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
fi
iptables -t mangle -I OUTPUT -j openclash
iptables -t mangle -I PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -I PREROUTING -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -I PREROUTING -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -I PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK"
iptables -t nat -I PREROUTING -p tcp --dport 53 -j ACCEPT
#ipv6
# if [ "$ipv6_enable" -eq 1 ]; then
@ -893,61 +856,67 @@ fi
revert_firewall()
{
rm -rf /var/etc/openclash.include 2>/dev/null
#ipv4
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip route del local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
iptables -t nat -D PREROUTING -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1
iptables -t mangle -F openclash >/dev/null 2>&1
iptables -t mangle -D PREROUTING -p udp -j openclash >/dev/null 2>&1
iptables -t mangle -X openclash >/dev/null 2>&1
iptables -t nat -F openclash >/dev/null 2>&1
iptables -t nat -D PREROUTING -p tcp -j openclash >/dev/null 2>&1
iptables -t nat -X openclash >/dev/null 2>&1
out_lines=$(iptables -nvL OUTPUT -t mangle |sed 1,2d |sed -n '/198.18.0.0\/16/=' 2>/dev/null |sort -rn)
for out_line in $out_lines; do
iptables -t mangle -D OUTPUT "$out_line" >/dev/null 2>&1
done
out_lines=$(iptables -nvL OUTPUT -t nat |sed 1,2d |sed -n '/198.18.0.0\/16/=' 2>/dev/null |sort -rn)
iptables -t nat -F openclash_output >/dev/null 2>&1
iptables -t nat -X openclash_output >/dev/null 2>&1
out_lines=$(iptables -nvL OUTPUT -t nat |sed 1,2d |sed -n '/openclash/=' 2>/dev/null |sort -rn)
for out_line in $out_lines; do
iptables -t nat -D OUTPUT "$out_line" >/dev/null 2>&1
done
#pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/8\.8\./=' 2>/dev/null |sort -rn)
#for pre_line in $pre_lines; do
# iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1
#done
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/8\.8\./=' 2>/dev/null |sort -rn)
for pre_line in $pre_lines; do
iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1
done
pre_lines=$(iptables -nvL PREROUTING -t mangle |sed 1,2d |sed -n '/openclash/=' 2>/dev/null |sort -rn)
for pre_line in $pre_lines; do
iptables -t mangle -D PREROUTING "$pre_line" >/dev/null 2>&1
done
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/openclash/=' 2>/dev/null |sort -rn)
for pre_line in $pre_lines; do
iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1
done
#ipv6
ip6tables -t mangle -F openclash >/dev/null 2>&1
ip6tables -t mangle -D PREROUTING -p udp -j openclash >/dev/null 2>&1
ip6tables -t mangle -X openclash >/dev/null 2>&1
#ip6tables -t mangle -F openclash >/dev/null 2>&1
#ip6tables -t mangle -D PREROUTING -p udp -j openclash >/dev/null 2>&1
#ip6tables -t mangle -X openclash >/dev/null 2>&1
ip6tables -t nat -F openclash >/dev/null 2>&1
ip6tables -t nat -D PREROUTING -p tcp -j openclash >/dev/null 2>&1
ip6tables -t nat -X openclash >/dev/null 2>&1
#TUN
ip route del default dev clash0 table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip route del default dev utun table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip link set dev clash0 down >/dev/null 2>&1
ip tuntap del clash0 mode tun >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash >/dev/null 2>&1
iptables -t mangle -D PREROUTING -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -D PREROUTING -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -D PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK" >/dev/null 2>&1
ip6tables -t mangle -D PREROUTING -j MARK --set-mark "$PROXY_FWMARK" >/dev/null 2>&1
iptables -t mangle -F openclash >/dev/null 2>&1
iptables -t mangle -X openclash >/dev/null 2>&1
#ip6tables -t mangle -D PREROUTING -j MARK --set-mark "$PROXY_FWMARK" >/dev/null 2>&1
ipset destroy localnetwork >/dev/null 2>&1
ipset destroy lan_ac_white_ips >/dev/null 2>&1
ipset destroy lan_ac_black_ips >/dev/null 2>&1
@ -968,7 +937,6 @@ get_config()
lan_ip=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
wan_ip4=$(ifconfig | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 2>/dev/null)
lan_ip6=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
log_level=$(uci get openclash.config.log_level 2>/dev/null)
proxy_mode=$(uci get openclash.config.proxy_mode 2>/dev/null)
@ -1056,7 +1024,6 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
echo "第九步: 重启 Dnsmasq 程序..." >$START_LOG
change_dns "$enable_redirect_dns" "$disable_masq_cache"
fake_block "$en_mode" "$direct_dns"
/etc/init.d/dnsmasq restart >/dev/null 2>&1
if pidof clash >/dev/null; then
echo "第十步: 还原策略组节点状态..." >$START_LOG

View File

@ -1,22 +1,11 @@
*.lan
#放行NTP服务
time.windows.com
time.nist.gov
time.apple.com
time.asia.apple.com
cn.ntp.org.cn
edu.ntp.org.cn
hk.ntp.org.cn
tw.ntp.org.cn
us.ntp.org.cn
sgp.ntp.org.cn
kr.ntp.org.cn
jp.ntp.org.cn
de.ntp.org.cn
ina.ntp.org.cn
0.openwrt.pool.ntp.org
1.openwrt.pool.ntp.org
2.openwrt.pool.ntp.org
3.openwrt.pool.ntp.org
*.ntp.org.cn
*.openwrt.pool.ntp.org
time1.cloud.tencent.com
time.ustc.edu.cn
pool.ntp.org
@ -36,12 +25,7 @@ time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.com
s1c.time.edu.cn
s2m.time.edu.cn
s1b.time.edu.cn
s1e.time.edu.cn
s2a.time.edu.cn
s2b.time.edu.cn
*.time.edu.cn
time1.apple.com
time2.apple.com
time3.apple.com
@ -55,28 +39,23 @@ time3.google.com
time4.google.com
#放行网易云音乐
music.163.com
interface.music.163.com
interface3.music.163.com
apm.music.163.com
apm3.music.163.com
clientlog.music.163.com
clientlog3.music.163.com
music.126.net
vod.126.net
*.music.163.com
*.126.net
#百度音乐
sug.qianqian.com
musicapi.taihe.com
music.taihe.com
#酷狗音乐
songsearch.kugou.com
trackercdn.kugou.com
#酷我音乐
kuwo.cn
*.kuwo.cn
#JOOX音乐
api-jooxtt.sanook.com
api.joox.com
joox.com
#QQ音乐
y.qq.com
*.y.qq.com
streamoc.music.tc.qq.com
mobileoc.music.tc.qq.com
isure.stream.qqmusic.qq.com
@ -84,19 +63,19 @@ dl.stream.qqmusic.qq.com
aqqmusic.tc.qq.com
amobile.music.tc.qq.com
#虾米音乐
xiami.com
*.xiami.com
#咪咕音乐
*.music.migu.cn
music.migu.cn
migu.cn
#win10本地连接检测
msftconnecttest.com
msftncsi.com
*.msftconnecttest.com
*.msftncsi.com
#QQ快捷登录
ptlogin2.qq.com
localhost.ptlogin2.qq.com
#Nintendo Switch
srv.nintendo.net
*.*.*.srv.nintendo.net
#Sony PlayStation
stun.playstation.net
*.*.stun.playstation.net
#Microsoft Xbox
microsoft.com
xboxlive.com
xbox.*.*.microsoft.com
*.*.xboxlive.com

File diff suppressed because one or more lines are too long

View File

@ -5,10 +5,12 @@ function index()
return
end
local page = entry({"admin", "services", "openclash"}, alias("admin", "services", "openclash", "client"), _("OpenClash"), 50)
local page
page = entry({"admin", "services", "openclash"}, alias("admin", "services", "openclash", "client"), _("OpenClash"), 50)
page.dependent = true
page.acl_depends = { "luci-app-openclash" }
entry({"admin", "services", "openclash", "client"},form("openclash/client"),_("Overviews"), 20).leaf = true
entry({"admin", "services", "openclash", "client"},cbi("openclash/client"),_("Overviews"), 20).leaf = true
entry({"admin", "services", "openclash", "status"},call("action_status")).leaf=true
entry({"admin", "services", "openclash", "state"},call("action_state")).leaf=true
entry({"admin", "services", "openclash", "startlog"},call("action_start")).leaf=true
@ -32,7 +34,7 @@ function index()
entry({"admin", "services", "openclash", "groups-config"},cbi("openclash/groups-config"), nil).leaf = true
entry({"admin", "services", "openclash", "proxy-provider-config"},cbi("openclash/proxy-provider-config"), nil).leaf = true
entry({"admin", "services", "openclash", "config"},form("openclash/config"),_("Config Manage"), 70).leaf = true
entry({"admin", "services", "openclash", "log"},form("openclash/log"),_("Server Logs"), 80).leaf = true
entry({"admin", "services", "openclash", "log"},cbi("openclash/log"),_("Server Logs"), 80).leaf = true
end
local fs = require "luci.openclash"

View File

@ -99,9 +99,9 @@ end
e[t].check=translate(config_check(CONFIG_FILE))
end
end
form=SimpleForm("filelist")
form.reset=false
form.submit=false
form = Map("openclash")
form.pageaction = false
tb=form:section(Table,e)
st=tb:option(DummyValue,"state",translate("State"))
st.template="openclash/cfg_check"
@ -139,9 +139,9 @@ local t = {
{enable, disable}
}
ap = SimpleForm("apply")
ap.reset = false
ap.submit = false
ap = Map("openclash")
ap.pageaction = false
ss = ap:section(Table, t)
o = ss:option(Button, "enable")

View File

@ -334,7 +334,7 @@ s = m:section(Table, tab)
local conf = string.sub(luci.sys.exec("uci get openclash.config.config_path 2>/dev/null"), 1, -2)
local dconf = "/etc/openclash/default.yaml"
local conf_name = fs.basename(conf)
if not conf_name then conf_name = "config.yaml" end
if not conf_name or conf == "" then conf_name = "config.yaml" end
sev = s:option(Value, "user")
sev.template = "cbi/tvalue"

View File

@ -86,6 +86,7 @@ uci:foreach("openclash", "groups",
o:value("DIRECT")
o:value("REJECT")
o:depends("type", "select")
o:depends("type", "relay")
o.rmempty = true
local t = {

View File

@ -25,23 +25,20 @@ local t = {
{refresh, clean}
}
a = SimpleForm("apply")
a.reset = false
a.submit = false
s = a:section(Table, t)
a = m:section(Table, t)
o = s:option(Button, "refresh")
o = a:option(Button, "refresh")
o.inputtitle = translate("Refresh Log")
o.inputstyle = "apply"
o.write = function()
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "log"))
end
o = s:option(Button, "clean")
o = a:option(Button, "clean")
o.inputtitle = translate("Clean Log")
o.inputstyle = "apply"
o.write = function()
SYS.call("echo '' >/tmp/openclash.log")
end
return m, a
return m

View File

@ -101,7 +101,7 @@ o.description = font_red..bold_on..translate("No Need Set when Config Create, Th
o.rmempty = true
m.uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil and s.type ~= "relay" then
if s.name ~= "" and s.name ~= nil then
o:value(s.name)
end
end)

View File

@ -279,7 +279,7 @@ o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
sys.call("sh /usr/share/openclash/cfg_servers_address_fake_block.sh &")
sys.call("/usr/share/openclash/cfg_servers_address_fake_filter.sh &")
luci.http.redirect(m.redirect)
end

View File

@ -175,25 +175,19 @@ o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("dns", Value, "direct_dns", translate("Specify DNS Server"))
o.description = translate("Specify DNS Server For List, Only One IP Server Address Support")
o.default="114.114.114.114"
o.placeholder = translate("114.114.114.114 or 127.0.0.1#5300")
o:depends("dns_advanced_setting", "1")
o = s:taboption("dns", Button, translate("Fake-IP Block List Update"))
o.title = translate("Fake-IP Block List Update")
o = s:taboption("dns", Button, translate("Fake-IP-Filter List Update"))
o.title = translate("Fake-IP-Filter List Update")
o:depends("dns_advanced_setting", "1")
o.inputtitle = translate("Check And Update")
o.inputstyle = "reload"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
SYS.call("/usr/share/openclash/openclash_fake_block.sh >/dev/null 2>&1 && /etc/init.d/openclash restart >/dev/null 2>&1 &")
SYS.call("/usr/share/openclash/openclash_fake_filter.sh >/dev/null 2>&1 && /etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
custom_fake_black = s:taboption("dns", Value, "custom_fake_black")
custom_fake_black = s:taboption("dns", Value, "custom_fake_filter")
custom_fake_black.template = "cbi/tvalue"
custom_fake_black.description = translate("Domain Names In The List Do Not Return Fake-IP, One rule per line")
custom_fake_black.rows = 20
@ -201,13 +195,13 @@ custom_fake_black.wrap = "off"
custom_fake_black:depends("dns_advanced_setting", "1")
function custom_fake_black.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_fake_black.conf") or ""
return NXFS.readfile("/etc/openclash/custom/openclash_custom_fake_filter.list") or ""
end
function custom_fake_black.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/openclash/custom/openclash_custom_fake_black.conf", value)
NXFS.writefile("/etc/openclash/custom/openclash_custom_fake_filter.list", value)
end
end
end

View File

@ -44,7 +44,11 @@
</fieldset>
<fieldset class="cbi-section">
<table width="100%">
<tr><td width="100%" colspan="4" align="center" id="restore"><%:Collecting data...%></td></tr>
<tr><td width="100%" colspan="4">
<p align="center" id="restore">
<%:Collecting data...%>
</p>
</td></tr>
</table>
</fieldset>

View File

@ -1,13 +0,0 @@
#!/bin/sh
status=$(ps|grep -c /usr/share/openclash/cfg_servers_address_fake_block.sh)
[ "$status" -gt "3" ] && exit 0
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
if pidof clash >/dev/null && [ "$en_mode" != "redir-host" ]; then
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
/usr/share/openclash/openclash_fake_block.sh
mkdir -p /tmp/dnsmasq.d
ln -s /etc/openclash/dnsmasq_fake_block.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi

View File

@ -0,0 +1,18 @@
#!/bin/sh
status=$(ps|grep -c /usr/share/openclash/cfg_servers_address_fake_filter.sh)
[ "$status" -gt "3" ] && exit 0
START_LOG="/tmp/openclash_start.log"
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
if pidof clash >/dev/null && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
/usr/share/openclash/openclash_fake_filter.sh
if [ -s "/etc/openclash/servers_fake_filter.conf" ]; then
mkdir -p /tmp/dnsmasq.d
ln -s /etc/openclash/servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
echo "" >$START_LOG
fi

View File

@ -6,6 +6,7 @@ START_LOG="/tmp/openclash_start.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
LOG_FILE="/tmp/openclash.log"
CFG_FILE="/tmp/config.yaml"
CRON_FILE="/etc/crontabs/root"
CONFIG_PATH=$(uci get openclash.config.config_path 2>/dev/null)
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
@ -15,7 +16,7 @@ if_restart=0
urlencode() {
local data
if [ "$#" -eq "1" ]; then
if [ "$#" -eq 1 ]; then
data=$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "$1" "")
if [ ! -z "$data" ]; then
echo "${data##/?}"
@ -23,6 +24,13 @@ urlencode() {
fi
}
kill_watchdog() {
watchdog_pids=$(ps |grep openclash_watchdog.sh |grep -v grep |awk '{print $1}' 2>/dev/null)
for watchdog_pid in $watchdog_pids; do
kill -9 "$watchdog_pid" >/dev/null 2>&1
done
}
config_download()
{
if [ "$URL_TYPE" == "v2rayn" ]; then
@ -78,7 +86,7 @@ config_su_check()
echo "配置文件下载成功,检查是否有更新..." >$START_LOG
if [ -f "$CONFIG_FILE" ]; then
cmp -s "$BACKPACK_FILE" "$CFG_FILE"
if [ "$?" -ne "0" ]; then
if [ "$?" -ne 0 ]; then
echo "配置文件【$name】有更新,开始替换..." >$START_LOG
mv "$CFG_FILE" "$CONFIG_FILE" 2>/dev/null
cp "$CONFIG_FILE" "$BACKPACK_FILE"
@ -115,12 +123,12 @@ config_error()
change_dns()
{
if pidof clash >/dev/null; then
if [ "$enable_redirect_dns" -ne "0" ]; then
if [ "$enable_redirect_dns" -ne 0 ]; then
uci del dhcp.@dnsmasq[-1].server >/dev/null 2>&1
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
uci delete dhcp.@dnsmasq[0].resolvfile >/dev/null 2>&1
uci set dhcp.@dnsmasq[0].noresolv=1 >/dev/null 2>&1
[ "$disable_masq_cache" -eq "1" ] && {
[ "$disable_masq_cache" -eq 1 ] && {
uci set dhcp.@dnsmasq[0].cachesize=0 >/dev/null 2>&1
}
uci commit dhcp
@ -135,10 +143,7 @@ config_download_direct()
if pidof clash >/dev/null; then
echo "配置文件【$name】下载失败,尝试不使用代理下载配置文件..." >$START_LOG
watchdog_pids=$(ps |grep openclash_watchdog.sh |grep -v grep |awk '{print $1}' 2>/dev/null)
for watchdog_pid in $watchdog_pids; do
kill -9 "$watchdog_pid" >/dev/null 2>&1
done
kill_watchdog
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
@ -150,7 +155,7 @@ config_download_direct()
config_download
if [ "$?" -eq "0" ] && [ -s "$CFG_FILE" ]; then
if [ "$?" -eq 0 ] && [ -s "$CFG_FILE" ]; then
change_dns
config_su_check
else
@ -171,7 +176,7 @@ sub_info_get()
config_get "address" "$section" "address" ""
config_get "keyword" "$section" "keyword" ""
if [ "$enabled" = "0" ]; then
if [ "$enabled" -eq 0 ]; then
return
fi
@ -196,7 +201,7 @@ sub_info_get()
config_download
if [ "$?" -eq "0" ] && [ -s "$CFG_FILE" ]; then
if [ "$?" -eq 0 ] && [ -s "$CFG_FILE" ]; then
config_encode
grep "^ \{0,\}Proxy Group:" "$CFG_FILE" >/dev/null 2>&1 && grep "^ \{0,\}Rule:" "$CFG_FILE" >/dev/null 2>&1
if [ "$?" -eq 0 ]; then
@ -219,4 +224,11 @@ config_load "openclash"
config_foreach sub_info_get "config_subscribe"
uci delete openclash.config.config_update_path >/dev/null 2>&1
uci commit openclash
[ "$if_restart" == "1" ] && /etc/init.d/openclash restart >/dev/null 2>&1
if [ "$if_restart" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1
else
sed -i '/openclash.sh/d' $CRON_FILE 2>/dev/null
[ "$(uci get openclash.config.auto_update 2>/dev/null)" -eq 1 ] && [ "$(uci get openclash.config.config_auto_update_mode 2>/dev/null)" -ne 1 ] && echo "0 $(uci get openclash.config.auto_update_time 2>/dev/null) * * $(uci get openclash.config.config_update_week_time 2>/dev/null) /usr/share/openclash/openclash.sh" >> $CRON_FILE
/etc/init.d/cron restart
fi

View File

@ -23,25 +23,27 @@ case $CORE_TYPE in
"Tun")
CORE_CV=$(/etc/openclash/core/clash_tun -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 2p /tmp/clash_last_version 2>/dev/null)
if [ "$en_mode" = "fake-ip-tun" ] || [ "$en_mode" = "redir-host-tun" ] || [ -z "$(pidof clash)" ]; then
if [ "$en_mode" = "fake-ip-tun" ] || [ "$en_mode" = "redir-host-tun" ]; then
if_restart=1
fi
;;
"Game")
CORE_CV=$(/etc/openclash/core/clash_game -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 3p /tmp/clash_last_version 2>/dev/null)
if [ "$en_mode" = "fake-ip-vpn" ] || [ "$en_mode" = "redir-host-vpn" ] || [ -z "$(pidof clash)" ]; then
if [ "$en_mode" = "fake-ip-vpn" ] || [ "$en_mode" = "redir-host-vpn" ]; then
if_restart=1
fi
;;
*)
CORE_CV=$(/etc/openclash/core/clash -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
if [ "$en_mode" = "fake-ip" ] || [ "$en_mode" = "redir-host" ] || [ -z "$(pidof clash)" ]; then
if [ "$en_mode" = "fake-ip" ] || [ "$en_mode" = "redir-host" ]; then
if_restart=1
fi
esac
[ -z "$(pidof clash)" ] && if_restart=0
if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ "$CPU_MODEL" != 0 ]; then
if pidof clash >/dev/null; then
@ -98,7 +100,10 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
rm -rf /tmp/clash.gz >/dev/null 2>&1
mkdir -p /etc/openclash/core
[ "$if_restart" -eq 1 ] && kill -9 "$(pidof clash|sed 's/$//g')" 2>/dev/null && /etc/init.d/openclash stop
if [ "$if_restart" -eq 1 ]; then
kill -9 "$(pidof clash|sed 's/$//g')" 2>/dev/null
/etc/init.d/openclash stop
fi
echo "【"$CORE_TYPE"】版本内核下载成功,开始更新..." >$START_LOG
case $CORE_TYPE in
"Tun")

View File

@ -6,13 +6,13 @@ status=$(ps|grep -c /usr/share/openclash/openclash_debug.sh)
DEBUG_LOG="/tmp/openclash_debug.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
uci commit openclash
enable_custom_dns=$(uci get openclash.config.enable_custom_dns 2>/dev/null)
rule_source=$(uci get openclash.config.rule_source 2>/dev/null)
enable_custom_clash_rules=$(uci get openclash.config.enable_custom_clash_rules 2>/dev/null)
ipv6_enable=$(uci get openclash.config.ipv6_enable 2>/dev/null)
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
proxy_mode=$(uci get openclash.config.proxy_mode 2>/dev/null)
intranet_allowed=$(uci get openclash.config.intranet_allowed 2>/dev/null)
@ -110,6 +110,9 @@ cat >> "$DEBUG_LOG" <<-EOF
运行状态: 未运行
EOF
fi
if [ "$core_type" = "0" ]; then
core_type="未选择架构"
fi
cat >> "$DEBUG_LOG" <<-EOF
已选择的架构: $core_type
@ -195,7 +198,6 @@ UDP流量转发: $(ts_cf "$enable_udp_proxy")
DNS劫持: $(ts_cf "$enable_redirect_dns")
自定义DNS: $(ts_cf "$enable_custom_dns")
IPV6-DNS解析: $(ts_cf "$ipv6_enable")
Real-IP-DNS地址: $direct_dns
禁用Dnsmasq缓存: $(ts_cf "$disable_masq_cache")
自定义规则: $(ts_cf "$enable_custom_clash_rules")
仅允许内网: $(ts_cf "$intranet_allowed")

View File

@ -1,40 +0,0 @@
#!/bin/bash /etc/rc.common
START_LOG="/tmp/openclash_start.log"
echo "正在设置Fake-IP黑名单..." >$START_LOG
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
[ -z "$direct_dns" ] && {
direct_dns="114.114.114.114"
}
rm -rf /etc/openclash/dnsmasq_fake_block.conf 2>/dev/null
for i in `cat /etc/openclash/custom/openclash_custom_fake_black.conf`
do
if [ -z "$(echo $i |grep '^ \{0,\}#' 2>/dev/null)" ]; then
echo "server=/$i/$direct_dns" >>/etc/openclash/dnsmasq_fake_block.conf
fi
done
cfg_server_address()
{
local section="$1"
config_get "server" "$section" "server" ""
IFIP=$(echo $server |grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
if [ -z "$IFIP" ] && [ ! -z "$server" ]; then
echo "server=/$server/$direct_dns" >>/etc/openclash/dnsmasq_fake_block.conf
noip="false"
else
return
fi
}
#Fake下正确检测节点延迟
noip="true"
echo "#Server Nodes" >>/etc/openclash/dnsmasq_fake_block.conf
config_load "openclash"
config_foreach cfg_server_address "servers"
[ "$noip" = "true" ] && {
sed -i '/#Server Nodes/d' /etc/openclash/dnsmasq_fake_block.conf 2>/dev/null
}
echo "" >$START_LOG

View File

@ -0,0 +1,46 @@
#!/bin/bash
. /lib/functions.sh
START_LOG="/tmp/openclash_start.log"
CUSTOM_FILE="/etc/openclash/custom/openclash_custom_fake_filter.list"
FAKE_FILTER_FILE="/etc/openclash/fake_filter.list"
SER_FAKE_FILTER_FILE="/etc/openclash/servers_fake_filter.conf"
echo "正在设置Fake-IP黑名单..." >$START_LOG
rm -rf "$FAKE_FILTER_FILE" 2>/dev/null
if [ -s "$CUSTOM_FILE" ]; then
cat "$CUSTOM_FILE" |while read -r line
do
if [ -z "$(echo $line |grep '^ \{0,\}#' 2>/dev/null)" ]; then
echo " - '$line'" >> "$FAKE_FILTER_FILE"
else
continue
fi
done
if [ -s "$FAKE_FILTER_FILE" ]; then
sed -i '1i\##Custom fake-ip-filter##' "$FAKE_FILTER_FILE"
echo "##Custom fake-ip-filter END##" >> "$FAKE_FILTER_FILE"
else
rm -rf "$FAKE_FILTER_FILE" 2>/dev/null
fi
fi
cfg_server_address()
{
local section="$1"
config_get "server" "$section" "server" ""
IFIP=$(echo $server |grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
if [ -z "$IFIP" ] && [ ! -z "$server" ]; then
echo "server=/$server/114.114.114.114" >> "$SER_FAKE_FILTER_FILE"
else
return
fi
}
#Fake下正确检测节点延迟
rm -rf "$SER_FAKE_FILTER_FILE" 2>/dev/null
config_load "openclash"
config_foreach cfg_server_address "servers"

View File

@ -8,8 +8,10 @@ PROXY_ROUTE_TABLE="0x162"
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
CRASH_NUM=0
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
cfg_update_interval=$(uci get openclash.config.config_update_interval 2>/dev/null)
CRASH_NUM=0
CFG_UPDATE_INT=0
if [ "$en_mode" = "fake-ip-tun" ] || [ "$en_mode" = "redir-host-tun" ]; then
core_type="Tun"
@ -22,8 +24,11 @@ fi
while :;
do
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
cfg_update=$(uci get openclash.config.auto_update 2>/dev/null)
cfg_update_mode=$(uci get openclash.config.config_auto_update_mode 2>/dev/null)
cfg_update_interval_now=$(uci get openclash.config.config_update_interval 2>/dev/null)
enable=$(uci get openclash.config.enable)
if [ "$enable" -eq 1 ]; then
if ! pidof clash >/dev/null; then
CRASH_NUM=$(expr "$CRASH_NUM" + 1)
@ -71,14 +76,14 @@ fi
fi
## DNS转发劫持
if [ "$enable_redirect_dns" != "0" ]; then
if [ "$enable_redirect_dns" -ne 0 ]; then
if [ -z "$(uci get dhcp.@dnsmasq[0].server 2>/dev/null |grep "$dns_port")" ] || [ ! -z "$(uci get dhcp.@dnsmasq[0].server 2>/dev/null |awk -F ' ' '{print $2}')" ]; then
echo "$LOGTIME Watchdog: Force Reset DNS Hijack." >> $LOG_FILE
uci del dhcp.@dnsmasq[-1].server >/dev/null 2>&1
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
uci delete dhcp.@dnsmasq[0].resolvfile
uci set dhcp.@dnsmasq[0].noresolv=1
[ "$disable_masq_cache" -eq "1" ] && {
[ "$disable_masq_cache" -eq 1 ] && {
uci set dhcp.@dnsmasq[0].cachesize=0
}
uci commit dhcp
@ -86,5 +91,20 @@ fi
fi
fi
## 配置文件循环更新
if [ "$cfg_update" -eq 1 ] && [ "$cfg_update_mode" -eq 1 ]; then
if [ -z "$cfg_update_interval_now" ]; then
cfg_update_interval_now=60
fi
if [ -z "$cfg_update_interval" ]; then
cfg_update_interval=60
fi
[ "$cfg_update_interval" -ne "$cfg_update_interval_now" ] && CFG_UPDATE_INT=0 && cfg_update_interval="$cfg_update_interval_now"
if [ "$CFG_UPDATE_INT" -ne 0 ]; then
[ "$(expr "$CFG_UPDATE_INT" % "$cfg_update_interval_now")" -eq 0 ] && /usr/share/openclash/openclash.sh
fi
CFG_UPDATE_INT=$(expr "$CFG_UPDATE_INT" + 1)
fi
sleep 60
done 2>/dev/null

View File

@ -1,4 +1,5 @@
#!/bin/sh
#删除旧hosts配置
hostlen=$(sed -n '/hosts:/=' "$7" 2>/dev/null)
dnslen=$(sed -n '/dns:/=' "$7" 2>/dev/null)
@ -186,4 +187,30 @@
sed -i '/^hosts:/a\##Custom HOSTS##' "$7" 2>/dev/null
sed -i '/##Custom HOSTS##/r/etc/openclash/custom/openclash_custom_hosts.list' "$7" 2>/dev/null
sed -i "/^hosts:/,/^dns:/ {s/^ \{0,\}'/ '/}" "$7" 2>/dev/null #修改参数空格
fi
fi
sed -i "s/^ \{0,\}- / - /" "$7" 2>/dev/null
if [ ! -z "$(grep "^ \{0,\}default-nameserver:" "$7")" ]; then
sed -i "/^ \{0,\}default-nameserver:/c\ default-nameserver:" "$7"
fi
#fake-ip-filter
sed -i '/##Custom fake-ip-filter##/,/##Custom fake-ip-filter END##/d' "$7" 2>/dev/null
if [ "$2" = "fake-ip" ]; then
if [ ! -f "/etc/openclash/fake_filter.list" ] || [ ! -z "$(grep "config servers" /etc/config/openclash)" ]; then
/usr/share/openclash/openclash_fake_filter.sh
fi
if [ -s "/etc/openclash/servers_fake_filter.conf" ]; then
mkdir -p /tmp/dnsmasq.d
ln -s /etc/openclash/servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
fi
if [ -s "/etc/openclash/fake_filter.list" ]; then
if [ ! -z "$(grep "^ \{0,\}fake-ip-filter:" "$7")" ]; then
sed -i "/^ \{0,\}fake-ip-filter:/c\ fake-ip-filter:" "$7"
sed -i '/fake-ip-filter:/r/etc/openclash/fake_filter.list' "$7" 2>/dev/null
else
echo " fake-ip-filter:" >> "$7"
sed -i '/fake-ip-filter:/r/etc/openclash/fake_filter.list' "$7" 2>/dev/null
fi
fi
fi

View File

@ -5,6 +5,7 @@ status=$(ps|grep -c /usr/share/openclash/yml_groups_get.sh)
START_LOG="/tmp/openclash_start.log"
CFG_FILE="/etc/config/openclash"
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
@ -109,7 +110,7 @@ cfg_delete()
config_load "openclash"
config_foreach cfg_group_name "groups"
if [ "$servers_if_update" -eq 1 ] && [ "$config_group_exist" -eq 1 ]; then
if [ "$servers_if_update" -eq 1 ] && [ "$servers_update" -eq 1 ] && [ "$config_group_exist" -eq 1 ]; then
/usr/share/openclash/yml_proxys_get.sh
exit 0
else

View File

@ -195,7 +195,7 @@ yml_groups_set()
set_group=0
set_proxy_provider=0
if [ "$type" = "select" ]; then
if [ "$type" = "select" ] || [ "$type" = "relay" ]; then
config_list_foreach "$section" "other_group" set_other_groups #加入其他策略组
fi
@ -209,9 +209,7 @@ yml_groups_set()
echo " use: $group_name" >>$GROUP_FILE
if [ "$type" != "relay" ]; then
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
fi
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
if [ "$set_group" -eq 1 ]; then
sed -i "/^ \{0,\}proxies: ${group_name}/c\ proxies:" $GROUP_FILE

View File

@ -159,7 +159,7 @@ cfg_new_provider_groups_get()
${uci_add}groups="${1}"
}
[ "$servers_update" -eq "1" ] && {
[ "$servers_update" -eq 1 ] && {
echo "" >"$match_provider"
provider_nums=0
config_load "openclash"
@ -214,7 +214,7 @@ do
#代理集存在时获取代理集编号
provider_nums=$(grep -Fw "$provider_name" "$match_provider" |awk -F '.' '{print $1}')
if [ "$servers_update" -eq "1" ] && [ ! -z "$provider_nums" ]; then
if [ "$servers_update" -eq 1 ] && [ ! -z "$provider_nums" ]; then
sed -i "/^${provider_nums}\./c\#match#" "$match_provider" 2>/dev/null
uci_set="uci -q set openclash.@proxy-provider["$provider_nums"]."
${uci_set}manual="0"
@ -237,7 +237,7 @@ do
uci_set="uci -q set $name.$uci_name_tmp."
uci_add="uci -q add_list $name.$uci_name_tmp."
if [ -z "$new_servers_group" ] && [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq "1" ]; then
if [ -z "$new_servers_group" ] && [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq 1 ]; then
${uci_set}enabled="0"
else
${uci_set}enabled="1"
@ -429,7 +429,7 @@ cfg_new_servers_groups_get()
echo "开始更新【$CONFIG_NAME】的服务器节点配置..." >$START_LOG
[ "$servers_update" -eq "1" ] && {
[ "$servers_update" -eq 1 ] && {
echo "" >"$match_servers"
server_num=0
config_load "openclash"
@ -483,7 +483,7 @@ do
#节点存在时获取节点编号
server_num=$(grep -Fw "$server_name" "$match_servers" |awk -F '.' '{print $1}')
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
if [ "$servers_update" -eq 1 ] && [ ! -z "$server_num" ]; then
sed -i "/^${server_num}\./c\#match#" "$match_servers" 2>/dev/null
fi
@ -568,7 +568,7 @@ do
echo "正在读取【$CONFIG_NAME】-【$server_type】-【$server_name】服务器节点配置..." >$START_LOG
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
if [ "$servers_update" -eq 1 ] && [ ! -z "$server_num" ]; then
#更新已有节点
uci_set="uci -q set openclash.@servers["$server_num"]."
uci_add="uci -q add_list $name.$uci_name_tmp."
@ -646,7 +646,7 @@ do
uci_set="uci -q set $name.$uci_name_tmp."
uci_add="uci -q add_list $name.$uci_name_tmp."
if [ -z "$new_servers_group" ] && [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq "1" ]; then
if [ -z "$new_servers_group" ] && [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq 1 ]; then
${uci_set}enabled="0"
else
${uci_set}enabled="1"
@ -772,7 +772,7 @@ fi
uci set openclash.config.servers_if_update=0
uci commit openclash
/usr/share/openclash/cfg_servers_address_fake_block.sh
/usr/share/openclash/cfg_servers_address_fake_filter.sh
echo "配置文件【$CONFIG_NAME】读取完成!" >$START_LOG
sleep 3
echo "" >$START_LOG

View File

@ -0,0 +1,11 @@
{
"luci-app-openclash": {
"description": "Grant UCI access for luci-app-openclash",
"read": {
"uci": [ "openclash" ]
},
"write": {
"uci": [ "openclash" ]
}
}
}

View File

@ -203,7 +203,7 @@ msgstr "指定下方列表中域名的DNS服务器只支持填写一个IP地
msgid "Domain Names In The List Do Not Return Fake-IP, One rule per line"
msgstr "每行请只填写一个域名列表中的域名在Fake-IP模式下查询DNS时将返回真实IP地址更改后点击上方按钮生效"
msgid "Fake-IP Block List Update"
msgid "Fake-IP-Filter List Update"
msgstr "更新Fake-IP域名黑名单"
msgid "Set OpenClash Upstream DNS Resolve Server"

View File

@ -8,9 +8,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ath10k-firmware
PKG_SOURCE_DATE:=2019-10-03
PKG_SOURCE_VERSION:=d622d160e9f552ead68d9ae81b715422892dc2ef
PKG_MIRROR_HASH:=2e504e071c3f896d629c4cfffe7ff4b5f1acdb4fecd3f01e8ff8c73e87a67cc7
PKG_SOURCE_DATE:=2020-05-06
PKG_SOURCE_VERSION:=d58efac2ae3e1ec1b1f45e7d5ead20d1b79f9415
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
@ -179,4 +178,4 @@ $(eval $(call BuildPackage,ath10k-firmware-qca988x))
#$(eval $(call BuildPackage,ath10k-firmware-qca99x0))
#$(eval $(call BuildPackage,ath10k-firmware-qca6174))
#$(eval $(call BuildPackage,ath10k-firmware-qca9984))
#$(eval $(call BuildPackage,ath10k-firmware-qca4019))
$(eval $(call BuildPackage,ath10k-firmware-qca4019))

View File

@ -19,7 +19,7 @@ define Package/ath10k-firmware-qca4019/install
$(PKG_BUILD_DIR)/ath10k/QCA4019/hw1.0/firmware-5.bin \
$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin
endef
$(eval $(call BuildPackage,ath10k-firmware-qca4019))
# $(eval $(call BuildPackage,ath10k-firmware-qca4019))
Package/ath10k-firmware-qca9887 = $(call Package/firmware-default,ath10k qca9887 firmware)
define Package/ath10k-firmware-qca9887/install

View File

@ -79,6 +79,13 @@ define Package/rtl8723bu-firmware/install
endef
$(eval $(call BuildPackage,rtl8723bu-firmware))
Package/rtl8723bs-firmware = $(call Package/firmware-default,RealTek RTL8723BS firmware)
define Package/rtl8723bs-firmware/install
$(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
$(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723bs*.bin $(1)/lib/firmware/rtlwifi
endef
$(eval $(call BuildPackage,rtl8723bs-firmware))
Package/rtl8821ae-firmware = $(call Package/firmware-default,RealTek RTL8821AE firmware)
define Package/rtl8821ae-firmware/install
$(INSTALL_DIR) $(1)/lib/firmware/rtlwifi

View File

@ -1199,7 +1199,7 @@ define KernelPackage/sfc
CONFIG_NET_VENDOR_SOLARFLARE=y \
CONFIG_SFC=y \
CONFIG_SFC_MTD=y \
CONFIG_MCDI_MON=y \
CONFIG_SFC_MCDI_MON=y \
CONFIG_SFC_SRIOV=n \
CONFIG_SFC_MCDI_LOGGING=n \
FILES:=$(LINUX_DIR)/drivers/net/ethernet/sfc/sfc.ko
@ -1231,3 +1231,19 @@ define KernelPackage/sfp/description
endef
$(eval $(call KernelPackage,sfp))
define KernelPackage/jme
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=JMicron(R) PCI-Express Gigabit Ethernet support
DEPENDS:=@PCI_SUPPORT +kmod-mii
KCONFIG:=CONFIG_JME
FILES:=$(LINUX_DIR)/drivers/net/ethernet/jme.ko
AUTOLOAD:=$(call AutoProbe,jme)
endef
define KernelPackage/jme/description
Supports JMicron(R) PCI-Express Gigabit Ethernet adapters
endef
$(eval $(call KernelPackage,jme))

View File

@ -590,7 +590,13 @@ mac80211_setup_supplicant() {
local add_sp=0
local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})"
wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1
[ "$enable" = 0 ] && {
ubus call wpa_supplicant.${phy} config_del "{\"iface\":\"$ifname\"}"
ip link set dev "$ifname" down
iw dev "$ifname" del
return 0
}
wpa_supplicant_prepare_interface "$ifname" nl80211 || {
iw dev "$ifname" del
return 1
@ -607,18 +613,17 @@ mac80211_setup_supplicant() {
[ "$spobj" ] && ubus call wpa_supplicant config_remove "{\"iface\":\"$ifname\"}"
add_sp=1
fi
[ "$enable" = 0 ] && {
ubus call wpa_supplicant config_remove "{\"iface\":\"$ifname\"}"
ip link set dev "$ifname" down
return 0
}
[ -z "$spobj" ] && add_sp=1
NEW_MD5_SP=$(test -e "${_config}" && md5sum ${_config})
OLD_MD5_SP=$(uci -q -P /var/state get wireless._${phy}.md5_${ifname})
if [ "$add_sp" = "1" ]; then
wpa_supplicant_run "$ifname" "$hostapd_ctrl"
else
ubus call $spobj reload
[ "${NEW_MD5_SP}" == "${OLD_MD5_SP}" ] || ubus call $spobj reload
fi
uci -q -P /var/state set wireless._${phy}.md5_${ifname}="${NEW_MD5_SP}"
return 0
}
mac80211_setup_supplicant_noctl() {
@ -765,7 +770,6 @@ mac80211_setup_vif() {
[ "$vif_enable" = 1 ] || action=down
if [ "$mode" != "ap" ] || [ "$ifname" = "$ap_ifname" ]; then
logger ip link set dev "$ifname" $action
ip link set dev "$ifname" "$action" || {
wireless_setup_vif_failed IFUP_ERROR
json_select ..
@ -923,8 +927,8 @@ drv_mac80211_setup() {
[ "$rxantenna" = "all" ] && rxantenna=0xffffffff
iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1
iw phy "$phy" set antenna_gain $antenna_gain
iw phy "$phy" set distance "$distance"
iw phy "$phy" set antenna_gain $antenna_gain >/dev/null 2>&1
iw phy "$phy" set distance "$distance" >/dev/null 2>&1
if [ -n "$txpower" ]; then
iw phy "$phy" set txpower fixed "${txpower%%.*}00"
@ -954,8 +958,8 @@ drv_mac80211_setup() {
OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5)
if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
[ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap || return
fi
[ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap
local add_ap=0
local primary_ap=${NEWAPLIST%% *}
[ -n "$hostapd_ctrl" ] && {
@ -966,7 +970,11 @@ drv_mac80211_setup() {
no_reload=$?
if [ "$no_reload" != "0" ]; then
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
[ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap || return
mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)"
mac80211_vap_cleanup none "$(uci -q -P /var/state get wireless._${phy}.umlist)"
sleep 2
mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
fi
}
fi
@ -1031,12 +1039,10 @@ list_phy_interfaces() {
drv_mac80211_teardown() {
wireless_process_kill_all
json_select data
json_get_vars phy
json_select ..
mac80211_interface_cleanup "$phy"
uci -q -P /var/state revert wireless._${phy}
for phy in `ls /sys/class/ieee80211/`; do
mac80211_interface_cleanup "$phy"
uci -q -P /var/state revert wireless._${phy}
done
}
add_driver mac80211

View File

@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=UnblockNeteaseMusic
PKG_VERSION:=0.24.1
PKG_VERSION:=0.25.0
PKG_RELEASE:=4
PKG_LICENSE:=MIT
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/nondanee/UnblockNeteaseMusic.git
PKG_SOURCE_VERSION:=9c9582401e999e1876c4baa204d35284a3d32bec
PKG_SOURCE_VERSION:=17cddd06278d0915697b3a342a182ed5e240200d
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION).tar.gz

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=default-settings
PKG_VERSION:=1.1
PKG_RELEASE:=57
PKG_RELEASE:=58
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE

View File

@ -1,46 +1,49 @@
#!/bin/sh
uci set network.vpn0="interface"
uci set network.vpn0.ifname="tun0"
uci set network.vpn0.proto="none"
uci commit network;
/etc/init.d/network reload
uci -q batch <<-EOF >/dev/null
delete network.vpn0
set network.vpn0=interface
set network.vpn0.ifname='tun0'
set network.vpn0.proto='none'
commit network
uci delete firewall.openvpn
uci add firewall rule
uci rename firewall.@rule[-1]="openvpn"
uci set firewall.@rule[-1].name="openvpn"
uci set firewall.@rule[-1].target="ACCEPT"
uci set firewall.@rule[-1].src="wan"
uci set firewall.@rule[-1].proto="tcp udp"
uci set firewall.@rule[-1].dest_port="1194"
delete firewall.openvpn
set firewall.openvpn=rule
set firewall.openvpn.name='openvpn'
set firewall.openvpn.target='ACCEPT'
set firewall.openvpn.src='wan'
set firewall.openvpn.proto='tcp udp'
set firewall.openvpn.dest_port='1194'
uci delete firewall.vpn
uci delete firewall.vpnwan
uci delete firewall.vpnlan
uci commit firewall
delete firewall.vpn
set firewall.vpn=zone
set firewall.vpn.name='vpn'
set firewall.vpn.input='ACCEPT'
set firewall.vpn.forward='ACCEPT'
set firewall.vpn.output='ACCEPT'
set firewall.vpn.masq='1'
set firewall.vpn.network='vpn0'
uci add firewall zone
uci rename firewall.@zone[-1]="vpn"
uci set firewall.@zone[-1].name="vpn"
uci set firewall.@zone[-1].input="ACCEPT"
uci set firewall.@zone[-1].forward="ACCEPT"
uci set firewall.@zone[-1].output="ACCEPT"
uci set firewall.@zone[-1].masq="1"
uci set firewall.@zone[-1].network="vpn0"
uci add firewall forwarding
uci rename firewall.@forwarding[-1]="vpnwan"
uci set firewall.@forwarding[-1].src="vpn"
uci set firewall.@forwarding[-1].dest="wan"
uci add firewall forwarding
uci rename firewall.@forwarding[-1]="vpnlan"
uci set firewall.@forwarding[-1].src="vpn"
uci set firewall.@forwarding[-1].dest="lan"
uci commit firewall;
/etc/init.d/firewall restart
delete firewall.vpntowan
set firewall.vpntowan=forwarding
set firewall.vpntowan.src='vpn'
set firewall.vpntowan.dest='wan'
/etc/init.d/openvpn enable
/etc/init.d/openvpn stop
delete firewall.vpntolan
set firewall.vpntolan=forwarding
set firewall.vpntolan.src='vpn'
set firewall.vpntolan.dest='lan'
delete firewall.lantovpn
set firewall.lantovpn=forwarding
set firewall.lantovpn.src='lan'
set firewall.lantovpn.dest='vpn'
commit firewall
EOF
chmod 0777 /etc/openvpn/server/checkpsw.sh
rm -f /tmp/luci-indexcache
exit 0

View File

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=npc
PKG_VERSION:=0.26.6
PKG_VERSION:=0.26.7
PKG_RELEASE:=2
ifeq ($(ARCH),mipsel)

View File

@ -264,7 +264,7 @@ CONFIG_BACKEND=file
# configuration can still be changed, the changes are just not going to be
# persistent over restarts. This option can be used to reduce code size by
# about 3.5 kB.
#CONFIG_NO_CONFIG_WRITE=y
CONFIG_NO_CONFIG_WRITE=y
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
#CONFIG_NO_CONFIG_BLOBS=y

View File

@ -264,7 +264,7 @@ CONFIG_BACKEND=file
# configuration can still be changed, the changes are just not going to be
# persistent over restarts. This option can be used to reduce code size by
# about 3.5 kB.
#CONFIG_NO_CONFIG_WRITE=y
CONFIG_NO_CONFIG_WRITE=y
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
#CONFIG_NO_CONFIG_BLOBS=y

View File

@ -15,7 +15,7 @@ PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
PKG_SOURCE_DATE:=2020-03-21
PKG_SOURCE_VERSION:=41a73232c16e9a063cfe3fad461c94af3f450f6c
PKG_MIRROR_HASH:=cf284c312b0c90974d11f8aeece173bcac8475f5b810911f4feb2c5a4db263fe
PKG_MIRROR_HASH:=7b966003b7c1bec95156159119b52583778405f0229dc7590911fa93f031552b
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-4-Clause
PKG_CPE_ID:=cpe:/a:samba:ppp

View File

@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard
PKG_VERSION:=1.0.20200429
PKG_VERSION:=1.0.20200506
PKG_RELEASE:=1
PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
PKG_HASH:=c0050a94c33c195d4129a75ab4dca05ba021c5265e40fce8b2dfda7d7055cda2
PKG_HASH:=98a99f2b825a82d57a7213e666f1ee4f7cc02bddb09bf4908b4b09447a8f121e
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@ -11,6 +11,7 @@
compatible = "tplink,tl-mr3040-v2", "qca,ar9331";
aliases {
serial0 = &uart;
led-boot = &led_lan;
led-failsafe = &led_lan;
label-mac-device = &eth0;

View File

@ -13,7 +13,7 @@
*
* DTS nodes are defined as follows:
* For fixed partitions:
* node-name@unit-address {
* node-name@unit-address {
* reg = <prop-encoded-array>;
* label = <string>;
* read-only;

View File

@ -0,0 +1,26 @@
From d9c8bc8c1408f3e8529db6e4e04017b4c579c342 Mon Sep 17 00:00:00 2001
From: Pawel Dembicki <paweldembicki@gmail.com>
Date: Sun, 18 Feb 2018 17:08:04 +0100
Subject: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio
In devices, where fdt is used, is impossible to apply platform data
without proper fdt node.
This patch allow to use platform data in devices with fdt.
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
---
drivers/w1/masters/w1-gpio.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -76,7 +76,7 @@ static int w1_gpio_probe(struct platform
enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN;
int err;
- if (of_have_populated_dt()) {
+ if (of_have_populated_dt() && !dev_get_platdata(&pdev->dev)) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;

View File

@ -52,7 +52,8 @@ ipq40xx_setup_interfaces()
avm,fritzrepeater-1200|\
dlink,dap-2610 |\
engenius,emd1|\
meraki,mr33)
meraki,mr33|\
zyxel,wre6606)
ucidef_set_interface_lan "eth0"
;;
glinet,gl-b1300|\
@ -74,9 +75,11 @@ ipq40xx_setup_interfaces()
"0t@eth0" "3:lan:2" "4:lan:1" "5:wan"
;;
netgear,ex6100v2|\
netgear,ex6150v2|\
netgear,ex6200v2|\
zyxel,wre6606)
netgear,ex6150v2)
ucidef_add_switch "switch0" \
"0u@eth0" "4:lan"
;;
netgear,ex6200v2)
ucidef_add_switch "switch0" \
"0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
;;

View File

@ -68,7 +68,6 @@
partition@0 {
label = "Bootloader";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {

View File

@ -31,10 +31,7 @@ platform_do_upgrade() {
default_do_upgrade "$1"
;;
xiaomi,miwifi-r3)
# this make it compatible with breed
dd if=/dev/mtd0 bs=64 count=1 2>/dev/null | grep -qi breed && CI_KERNPART_EXT="kernel_stock"
dd if=/dev/mtd7 bs=64 count=1 2>/dev/null | grep -o MIPS.*Linux | grep -qi X-WRT && CI_KERNPART_EXT="kernel_stock"
dd if=/dev/mtd7 bs=64 count=1 2>/dev/null | grep -o MIPS.*Linux | grep -qi NATCAP && CI_KERNPART_EXT="kernel0_rsvd"
nand_do_upgrade "$1"
;;
*)