Merge Lean's source

This commit is contained in:
CN_SZTL 2020-03-17 20:40:55 +08:00
commit af5cc73e79
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
11 changed files with 158 additions and 64 deletions

View File

@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +dnsmasq-full
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-adbyby-plus
PKG_VERSION:=2.0
PKG_RELEASE:=66
PKG_RELEASE:=67
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -3,7 +3,6 @@
START=98
STOP=10
USE_PROCD=1
EXTRA_COMMANDS="add_rule del_rule reload_rule"
PROG_PATH=/usr/share/adbyby
@ -188,7 +187,7 @@ reload_rule()
iptables-save | grep ADBYBY >/dev/null || add_rule
}
start_service()
start()
{
config_load adbyby
config_foreach get_config adbyby
@ -198,12 +197,7 @@ start_service()
[ ! -d "/tmp/adbyby/data" ] && cp -a /usr/share/adbyby /tmp/ && rm -f /tmp/adbyby.updated
add_rules
procd_open_instance
procd_set_param command '/tmp/adbyby/adbyby'
procd_append_param command '--no-daemon'
procd_set_param respawn
procd_set_param stderr 1
procd_close_instance
/tmp/adbyby/adbyby >/dev/null 2>&1 &
add_dns
iptables-save | grep ADBYBY >/dev/null || \
@ -212,8 +206,9 @@ start_service()
fi
}
stop_service()
stop()
{
kill -9 $(busybox ps -w | grep "/tmp/adbyby" | grep -v grep | awk '{print $1}') >/dev/null 2>&1
config_load adbyby
config_foreach get_config adbyby
del_rule

View File

@ -43,6 +43,6 @@ if [ ! -f "/tmp/adbyby.updated" ];then
rm -f /tmp/adbyby/data/*.bak
kill -9 $(busybox ps -w | grep 'adbyby --no-daemon' | grep -v grep | awk '{print $1}') >/dev/null 2>&1
/etc/init.d/adbyby restart
fi

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=169
PKG_RELEASE:=3
PKG_RELEASE:=6
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -118,4 +118,21 @@ o.remove = function(self, section, value)
NXFS.writefile(netflixconf, "")
end
s:tab("netflixip", translate("Netflix IP List"))
local netflixipconf = "/etc/config/netflixip.list"
o = s:taboption("netflixip", TextValue, "netflixipconf")
o.rows = 13
o.wrap = "off"
o.rmempty = true
o.cfgvalue = function(self, section)
return NXFS.readfile(netflixipconf) or " "
end
o.write = function(self, section, value)
NXFS.writefile(netflixipconf, value:gsub("\r\n", "\n"))
end
o.remove = function(self, section, value)
NXFS.writefile(netflixipconf, "")
end
return m

View File

@ -476,7 +476,7 @@ msgid "Please refer to the following writing"
msgstr "每行一个域名,无需写前面的 HTTP(S):// ,提交后即时生效"
msgid "Servers subscription and manage"
msgstr "服务器节点订阅与管理支持订阅和手动导入SSR链接"
msgstr "服务器节点订阅与管理"
msgid "Through proxy update list, Not Recommended"
msgstr "通过路由器自身代理更新订阅"
@ -648,3 +648,6 @@ msgstr "Netflix 分流服务器"
msgid "Netflix Domain List"
msgstr "Netflix 分流域名列表"
msgid "Netflix IP List"
msgstr "Netflix 分流IP列表"

View File

@ -0,0 +1,15 @@
8.41.4.0/24
23.246.0.0/18
37.77.184.0/21
45.57.0.0/17
64.120.128.0/17
66.197.128.0/17
69.53.224.0/19
108.175.32.0/20
185.2.220.0/22
185.9.188.0/22
192.173.64.0/18
198.38.96.0/19
198.45.48.0/20
207.45.72.0/22
208.75.76.0/22

View File

@ -310,28 +310,25 @@ start_redir() {
elif [ "$stype" == "tun" ]; then
sscmd="/usr/sbin/redsocks2"
fi
if [ "$NETFLIX_SERVER" != "same" ]; then
NETFLIX_SERVER=$GLOBAL_SERVER
local ntype=$(uci_get_by_name $NETFLIX_SERVER type)
if [ "$ntype" == "ss" ]; then
ncmd="/usr/bin/ss-redir"
sssock="/usr/bin/ss-local"
elif [ "$ntype" == "ssr" ]; then
ncmd="/usr/bin/ssr-redir"
sssock="/usr/bin/ssr-local"
elif [ "$ntype" == "v2ray" ]; then
ncmd="/usr/bin/v2ray/v2ray"
[ ! -f "$ncmd" ] && ncmd="/usr/bin/v2ray"
elif [ "$ntype" == "trojan" ]; then
ncmd="/usr/sbin/trojan"
elif [ "$ntype" == "socks5" ]; then
ncmd="/usr/sbin/redsocks2"
elif [ "$ntype" == "tun" ]; then
ncmd="/usr/sbin/redsocks2"
fi
fi
local ntype=$(uci_get_by_name $NETFLIX_SERVER type)
if [ "$ntype" == "ss" ]; then
ncmd="/usr/bin/ss-redir"
sssock="/usr/bin/ss-local"
elif [ "$ntype" == "ssr" ]; then
ncmd="/usr/bin/ssr-redir"
sssock="/usr/bin/ssr-local"
elif [ "$ntype" == "v2ray" ]; then
ncmd="/usr/bin/v2ray/v2ray"
[ ! -f "$ncmd" ] && ncmd="/usr/bin/v2ray"
elif [ "$ntype" == "trojan" ]; then
ncmd="/usr/sbin/trojan"
elif [ "$ntype" == "socks5" ]; then
ncmd="/usr/sbin/redsocks2"
elif [ "$ntype" == "tun" ]; then
ncmd="/usr/sbin/redsocks2"
fi
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
if [ "$utype" == "ss" ]; then
ucmd="/usr/bin/ss-redir"
@ -453,7 +450,7 @@ start_redir() {
local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
if [ "$ssr_dns" == "1" ]; then
if [ "$ssr_dns" != "0" ]; then # not use custom dns service
if [ "$run_mode" == "gfw" ]; then
ipset add gfwlist $dnsserver 2>/dev/null
elif [ "$run_mode" == "oversea" ]; then
@ -461,12 +458,14 @@ start_redir() {
else
ipset add ss_spec_wan_ac $dnsserver nomatch 2>/dev/null
fi
fi
if [ "$ssr_dns" == "1" ]; then
start_pdnsd $dnsserver $dnsport
pdnsd_enable_flag=1
elif [ "$ssr_dns" == "2" ]; then
microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 &
dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 &
pdnsd_enable_flag=2
microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 &
dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 &
pdnsd_enable_flag=2
fi
if [ "$(uci_get_by_type global enable_switch)" == "1" ]; then
if [ "$(uci_get_by_name $GLOBAL_SERVER switch_enable 1)" == "1" ]; then
@ -592,7 +591,10 @@ start() {
fi
NETFLIX_SERVER=$(uci_get_by_type global netflix_server same)
if [ "$NETFLIX_SERVER" == "same" ]; then
NETFLIX_SERVER=$GLOBAL_SERVER
fi
if rules; then
start_redir
mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/
@ -694,3 +696,4 @@ stop() {
fi
del_cron
}

View File

@ -583,3 +583,4 @@ CONFIG_XPS=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_BCJ=y
CONFIG_ZONE_DMA32=y
# CONFIG_RPI_AXIPERF is not set

View File

@ -3200,6 +3200,7 @@ CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_NET_9P is not set
# CONFIG_NET_ACT_BPF is not set
# CONFIG_NET_ACT_CSUM is not set
# CONFIG_NET_ACT_CTINFO is not set
# CONFIG_NET_ACT_GACT is not set
# CONFIG_NET_ACT_IFE is not set
# CONFIG_NET_ACT_IPT is not set

View File

@ -32,17 +32,67 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
{
struct property *pp = of_find_property(np, name, NULL);
@@ -48,6 +49,79 @@ static const void *of_get_mac_addr(struc
@@ -48,6 +49,138 @@ static const void *of_get_mac_addr(struc
return NULL;
}
+typedef int(*mtd_mac_address_read)(struct mtd_info *mtd, loff_t from, u_char *buf);
+
+static int read_mtd_mac_address(struct mtd_info *mtd, loff_t from, u_char *mac)
+{
+ size_t retlen;
+
+ return mtd_read(mtd, from, 6, &retlen, mac);
+}
+
+static int read_mtd_mac_address_ascii(struct mtd_info *mtd, loff_t from, u_char *mac)
+{
+ size_t retlen;
+ char buf[17];
+
+ if (mtd_read(mtd, from, 12, &retlen, buf)) {
+ return -1;
+ }
+ if (sscanf(buf, "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
+ &mac[0], &mac[1], &mac[2], &mac[3],
+ &mac[4], &mac[5]) == 6) {
+ if (mac[0] == '\0' && mac[1] == '\0') { /* First 2 bytes are zero, probably a bug. Trying to re-read */
+ buf[4] = '\0'; /* Make it null-terminated */
+ if (sscanf(buf, "%4hx", mac) == 1)
+ *(uint16_t*)mac = htons(*(uint16_t*)mac);
+ }
+ return 0;
+ }
+ if (mtd_read(mtd, from+12, 5, &retlen, buf+12)) {
+ return -1;
+ }
+ if (sscanf(buf, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
+ &mac[0], &mac[1], &mac[2], &mac[3],
+ &mac[4], &mac[5]) == 6) {
+ return 0;
+ }
+ return -1;
+}
+
+static struct mtd_mac_address_property {
+ char *name;
+ mtd_mac_address_read read;
+} mtd_mac_address_properties[] = {
+ {
+ .name = "mtd-mac-address",
+ .read = read_mtd_mac_address,
+ }, {
+ .name = "mtd-mac-address-ascii",
+ .read = read_mtd_mac_address_ascii,
+ },
+};
+
+static const void *of_get_mac_address_mtd(struct device_node *np)
+{
+#ifdef CONFIG_MTD
+ struct device_node *mtd_np = NULL;
+ struct property *prop;
+ size_t retlen;
+ int size, ret;
+ int size, ret = -1;
+ struct mtd_info *mtd;
+ const char *part;
+ const __be32 *list;
@ -51,28 +101,37 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ u8 mac[ETH_ALEN];
+ void *addr;
+ u32 inc_idx;
+ int i;
+
+ list = of_get_property(np, "mtd-mac-address", &size);
+ if (!list || (size != (2 * sizeof(*list))))
+ for (i = 0; i < ARRAY_SIZE(mtd_mac_address_properties); i++) {
+ list = of_get_property(np, mtd_mac_address_properties[i].name, &size);
+ if (!list || (size != (2 * sizeof(*list))))
+ continue;
+
+ phandle = be32_to_cpup(list++);
+ if (phandle)
+ mtd_np = of_find_node_by_phandle(phandle);
+
+ if (!mtd_np)
+ continue;
+
+ part = of_get_property(mtd_np, "label", NULL);
+ if (!part)
+ part = mtd_np->name;
+
+ mtd = get_mtd_device_nm(part);
+ if (IS_ERR(mtd))
+ continue;
+
+ ret = mtd_mac_address_properties[i].read(mtd, be32_to_cpup(list), mac);
+ put_mtd_device(mtd);
+ if (!ret) {
+ break;
+ }
+ }
+ if (ret) {
+ return NULL;
+
+ phandle = be32_to_cpup(list++);
+ if (phandle)
+ mtd_np = of_find_node_by_phandle(phandle);
+
+ if (!mtd_np)
+ return NULL;
+
+ part = of_get_property(mtd_np, "label", NULL);
+ if (!part)
+ part = mtd_np->name;
+
+ mtd = get_mtd_device_nm(part);
+ if (IS_ERR(mtd))
+ return NULL;
+
+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac);
+ put_mtd_device(mtd);
+ }
+
+ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx))
+ inc_idx = 5;
@ -112,7 +171,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/**
* Search the device tree for the best MAC address to use. 'mac-address' is
* checked first, because that is supposed to contain to "most recent" MAC
@@ -65,11 +139,18 @@ static const void *of_get_mac_addr(struc
@@ -65,11 +193,18 @@ static const void *of_get_mac_addr(struc
* addresses. Some older U-Boots only initialized 'local-mac-address'. In
* this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
* but is all zeros.