mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-01 16:27:08 +08:00
Merge branch 'master' of https://github.com/coolsnowwolf/lede
This commit is contained in:
commit
dd9feccea4
@ -16,32 +16,33 @@ pdnsd_genconfig() {
|
|||||||
|
|
||||||
if [ ! -f /var/dnscache/pdnsd.cache ]; then
|
if [ ! -f /var/dnscache/pdnsd.cache ]; then
|
||||||
mkdir -p /var/dnscache
|
mkdir -p /var/dnscache
|
||||||
echo -ne "pd13\000\000\000\000" > /var/dnscache/pdnsd.cache
|
echo -ne "pd13\000\000\000\000" >/var/dnscache/pdnsd.cache
|
||||||
chown -R nobody.nogroup /var/dnscache
|
chown -R nobody.nogroup /var/dnscache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat > /var/etc/dnscache.conf <<EOF
|
cat <<-EOF >/var/etc/dnscache.conf
|
||||||
global {
|
global {
|
||||||
perm_cache=1024; # dns缓存大小,单位KB,建议不要写的太大
|
perm_cache=1024; # dns缓存大小,单位KB,建议不要写的太大
|
||||||
cache_dir="/var/dnscache"; # 缓存文件的位置
|
cache_dir="/var/dnscache"; # 缓存文件的位置
|
||||||
pid_file = /var/run/dnscache.pid;
|
pid_file = /var/run/dnscache.pid;
|
||||||
server_ip = 0.0.0.0; # pdnsd监听的网卡,0.0.0.0是全部网卡
|
run_as="nobody";
|
||||||
server_port=5333; # pdnsd监听的端口,不要和别的服务冲突即可
|
server_ip = 0.0.0.0; # pdnsd监听的网卡,0.0.0.0是全部网卡
|
||||||
|
server_port=5333; # pdnsd监听的端口,不要和别的服务冲突即可
|
||||||
status_ctl = on;
|
status_ctl = on;
|
||||||
paranoid=on; # 二次请求模式,如果请求主DNS服务器返回的是垃圾地址,就向备用服务器请求
|
paranoid=on; # 二次请求模式,如果请求主DNS服务器返回的是垃圾地址,就向备用服务器请求
|
||||||
query_method=udp_only;
|
query_method=udp_only;
|
||||||
neg_domain_pol = off;
|
neg_domain_pol = off;
|
||||||
par_queries = 400; # 最多同时请求数
|
par_queries = 400; # 最多同时请求数
|
||||||
min_ttl = 1h; # DNS结果最短缓存时间
|
min_ttl = 1h; # DNS结果最短缓存时间
|
||||||
max_ttl = 1w; # DNS结果最长缓存时间
|
max_ttl = 1w; # DNS结果最长缓存时间
|
||||||
timeout = 10; # DNS请求超时时间,单位秒
|
timeout = 10; # DNS请求超时时间,单位秒
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
label = "routine";
|
label = "routine";
|
||||||
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址
|
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址
|
||||||
timeout = 5; # DNS请求超时时间
|
timeout = 5; # DNS请求超时时间
|
||||||
reject = 74.125.127.102, # 以下是脏IP,也就是DNS污染一般会返回的结果,如果收到如下DNS结果会触发二次请求(TCP协议一般不会碰到脏IP)
|
reject = 74.125.127.102, # 以下是脏IP,也就是DNS污染一般会返回的结果,如果收到如下DNS结果会触发二次请求(TCP协议一般不会碰到脏IP)
|
||||||
74.125.155.102,
|
74.125.155.102,
|
||||||
74.125.39.102,
|
74.125.39.102,
|
||||||
74.125.39.113,
|
74.125.39.113,
|
||||||
@ -101,33 +102,33 @@ server {
|
|||||||
249.129.46.48,
|
249.129.46.48,
|
||||||
253.157.14.165;
|
253.157.14.165;
|
||||||
reject_policy = fail;
|
reject_policy = fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
label = "special"; # 这个随便写
|
label = "special"; # 这个随便写
|
||||||
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
|
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
|
||||||
port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持)
|
port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持)
|
||||||
proxy_only = on;
|
proxy_only = on;
|
||||||
timeout = 5;
|
timeout = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
source {
|
source {
|
||||||
owner=localhost;
|
owner=localhost;
|
||||||
// serve_aliases=on;
|
// serve_aliases=on;
|
||||||
file="/etc/hosts";
|
file="/etc/hosts";
|
||||||
}
|
}
|
||||||
|
|
||||||
rr {
|
rr {
|
||||||
name=localhost;
|
name=localhost;
|
||||||
reverse=on;
|
reverse=on;
|
||||||
a=127.0.0.1;
|
a=127.0.0.1;
|
||||||
owner=localhost;
|
owner=localhost;
|
||||||
soa=localhost,root.localhost,42,86400,900,86400,86400;
|
soa=localhost,root.localhost,42,86400,900,86400,86400;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[ -d /var/sbin ] || mkdir -p /var/sbin
|
[ -d /var/sbin ] || mkdir -p /var/sbin
|
||||||
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache
|
[ -f /var/sbin/dnscache ] || ln -s /usr/sbin/pdnsd /var/sbin/dnscache
|
||||||
echo "Start DNS Cache"
|
echo "Start DNS Cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ revert_dns() {
|
|||||||
uci commit dhcp
|
uci commit dhcp
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service(){
|
start_service() {
|
||||||
dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null)
|
dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null)
|
||||||
bbr=$(uci get flowoffload.@flow[0].bbr 2>/dev/null)
|
bbr=$(uci get flowoffload.@flow[0].bbr 2>/dev/null)
|
||||||
if [ $dns -eq 1 ]; then
|
if [ $dns -eq 1 ]; then
|
||||||
@ -162,6 +163,8 @@ start_service(){
|
|||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
change_dns
|
change_dns
|
||||||
|
else
|
||||||
|
revert_dns
|
||||||
fi
|
fi
|
||||||
if [ $bbr -eq 1 ]; then
|
if [ $bbr -eq 1 ]; then
|
||||||
sysctl -w net.ipv4.tcp_congestion_control=bbr
|
sysctl -w net.ipv4.tcp_congestion_control=bbr
|
||||||
@ -177,7 +180,7 @@ start_service(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service(){
|
stop_service() {
|
||||||
dns=$(uci get firewall.@defaults[0].dns 2>/dev/null)
|
dns=$(uci get firewall.@defaults[0].dns 2>/dev/null)
|
||||||
revert_dns
|
revert_dns
|
||||||
uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading)
|
uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading)
|
||||||
@ -189,11 +192,10 @@ stop_service(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
restart(){
|
restart() {
|
||||||
DNSMASQ_RESTART=Y
|
DNSMASQ_RESTART=Y
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
/etc/init.d/dnsmasq restart && echo "DNSMASQ restart"
|
/etc/init.d/dnsmasq restart && echo "DNSMASQ restart"
|
||||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,15 +16,16 @@ pdnsd_genconfig() {
|
|||||||
|
|
||||||
if [ ! -f /var/dnscache/pdnsd.cache ]; then
|
if [ ! -f /var/dnscache/pdnsd.cache ]; then
|
||||||
mkdir -p /var/dnscache
|
mkdir -p /var/dnscache
|
||||||
echo -ne "pd13\000\000\000\000" > /var/dnscache/pdnsd.cache
|
echo -ne "pd13\000\000\000\000" >/var/dnscache/pdnsd.cache
|
||||||
chown -R nobody.nogroup /var/dnscache
|
chown -R nobody.nogroup /var/dnscache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat > /var/etc/dnscache.conf <<EOF
|
cat <<-EOF >/var/etc/dnscache.conf
|
||||||
global {
|
global {
|
||||||
perm_cache=1024; # dns缓存大小,单位KB,建议不要写的太大
|
perm_cache=1024; # dns缓存大小,单位KB,建议不要写的太大
|
||||||
cache_dir="/var/dnscache"; # 缓存文件的位置
|
cache_dir="/var/dnscache"; # 缓存文件的位置
|
||||||
pid_file = /var/run/dnscache.pid;
|
pid_file="/var/run/dnscache.pid";
|
||||||
|
run_as="nobody";
|
||||||
server_ip = 0.0.0.0; # pdnsd监听的网卡,0.0.0.0是全部网卡
|
server_ip = 0.0.0.0; # pdnsd监听的网卡,0.0.0.0是全部网卡
|
||||||
server_port=5333; # pdnsd监听的端口,不要和别的服务冲突即可
|
server_port=5333; # pdnsd监听的端口,不要和别的服务冲突即可
|
||||||
status_ctl = on;
|
status_ctl = on;
|
||||||
@ -35,9 +36,9 @@ global {
|
|||||||
min_ttl = 1h; # DNS结果最短缓存时间
|
min_ttl = 1h; # DNS结果最短缓存时间
|
||||||
max_ttl = 1w; # DNS结果最长缓存时间
|
max_ttl = 1w; # DNS结果最长缓存时间
|
||||||
timeout = 10; # DNS请求超时时间,单位秒
|
timeout = 10; # DNS请求超时时间,单位秒
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
label = "routine";
|
label = "routine";
|
||||||
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址
|
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址
|
||||||
timeout = 5; # DNS请求超时时间
|
timeout = 5; # DNS请求超时时间
|
||||||
@ -101,33 +102,33 @@ server {
|
|||||||
249.129.46.48,
|
249.129.46.48,
|
||||||
253.157.14.165;
|
253.157.14.165;
|
||||||
reject_policy = fail;
|
reject_policy = fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
label = "special"; # 这个随便写
|
label = "special"; # 这个随便写
|
||||||
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
|
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
|
||||||
port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持)
|
port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持)
|
||||||
proxy_only = on;
|
proxy_only = on;
|
||||||
timeout = 5;
|
timeout = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
source {
|
source {
|
||||||
owner=localhost;
|
owner=localhost;
|
||||||
// serve_aliases=on;
|
// serve_aliases=on;
|
||||||
file="/etc/hosts";
|
file="/etc/hosts";
|
||||||
}
|
}
|
||||||
|
|
||||||
rr {
|
rr {
|
||||||
name=localhost;
|
name=localhost;
|
||||||
reverse=on;
|
reverse=on;
|
||||||
a=127.0.0.1;
|
a=127.0.0.1;
|
||||||
owner=localhost;
|
owner=localhost;
|
||||||
soa=localhost,root.localhost,42,86400,900,86400,86400;
|
soa=localhost,root.localhost,42,86400,900,86400,86400;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[ -d /var/sbin ] || mkdir -p /var/sbin
|
[ -d /var/sbin ] || mkdir -p /var/sbin
|
||||||
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache
|
[ -f /var/sbin/dnscache ] || ln -s /usr/sbin/pdnsd /var/sbin/dnscache
|
||||||
}
|
}
|
||||||
|
|
||||||
change_dns() {
|
change_dns() {
|
||||||
@ -154,10 +155,10 @@ start_service() {
|
|||||||
|
|
||||||
if [ $enable -eq 1 ]; then
|
if [ $enable -eq 1 ]; then
|
||||||
! (lsmod | grep fast_classifier >/dev/null) && (modprobe fast_classifier)
|
! (lsmod | grep fast_classifier >/dev/null) && (modprobe fast_classifier)
|
||||||
if [ $wifi -eq 1 ] ; then
|
if [ $wifi -eq 1 ]; then
|
||||||
echo 1 > /sys/fast_classifier/skip_to_bridge_ingress
|
echo 1 >/sys/fast_classifier/skip_to_bridge_ingress
|
||||||
else
|
else
|
||||||
echo 0 > /sys/fast_classifier/skip_to_bridge_ingress
|
echo 0 >/sys/fast_classifier/skip_to_bridge_ingress
|
||||||
fi
|
fi
|
||||||
if [ $ipv6 -eq 1 ]; then
|
if [ $ipv6 -eq 1 ]; then
|
||||||
sfe_ipv6=$(cat /sys/sfe_ipv6/debug_dev)
|
sfe_ipv6=$(cat /sys/sfe_ipv6/debug_dev)
|
||||||
@ -177,6 +178,8 @@ start_service() {
|
|||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
change_dns
|
change_dns
|
||||||
|
else
|
||||||
|
revert_dns
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $bbr -eq 1 ]; then
|
if [ $bbr -eq 1 ]; then
|
||||||
@ -189,7 +192,7 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service(){
|
stop_service() {
|
||||||
enable=$(uci get sfe.config.enabled 2>/dev/null)
|
enable=$(uci get sfe.config.enabled 2>/dev/null)
|
||||||
[ $enable -ne 1 ] && rmmod fast_classifier >/dev/null 2>&1
|
[ $enable -ne 1 ] && rmmod fast_classifier >/dev/null 2>&1
|
||||||
revert_dns
|
revert_dns
|
||||||
@ -198,7 +201,7 @@ stop_service(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
restart(){
|
restart() {
|
||||||
DNSMASQ_RESTART=Y
|
DNSMASQ_RESTART=Y
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
|
@ -1,12 +1,55 @@
|
|||||||
/dts-v1/;
|
/dts-v1/;
|
||||||
|
|
||||||
#include "mt7621_phicomm_k2p_default.dtsi"
|
#include "mt7621_phicomm_k2p.dtsi"
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "phicomm,k2p-32m", "phicomm,k2p", "mediatek,mt7621-soc";
|
compatible = "phicomm,k2p-32m", "phicomm,k2p", "mediatek,mt7621-soc";
|
||||||
model = "Phicomm K2P (32M)";
|
model = "Phicomm K2P 32M";
|
||||||
};
|
};
|
||||||
|
|
||||||
&firmware {
|
&spi0 {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
m25p80@0 {
|
||||||
|
compatible = "jedec,spi-nor";
|
||||||
|
reg = <0>;
|
||||||
|
spi-max-frequency = <10000000>;
|
||||||
|
broken-flash-reset;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
label = "u-boot";
|
||||||
|
reg = <0x0 0x30000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@30000 {
|
||||||
|
label = "u-boot-env";
|
||||||
|
reg = <0x30000 0x10000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
factory: partition@40000 {
|
||||||
|
label = "factory";
|
||||||
|
reg = <0x40000 0x10000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@50000 {
|
||||||
|
label = "permanent_config";
|
||||||
|
reg = <0x50000 0x50000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@a0000 {
|
||||||
|
compatible = "denx,uimage";
|
||||||
|
label = "firmware";
|
||||||
reg = <0xa0000 0x1f60000>;
|
reg = <0xa0000 0x1f60000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,54 @@
|
|||||||
/dts-v1/;
|
/dts-v1/;
|
||||||
|
|
||||||
#include "mt7621_phicomm_k2p_default.dtsi"
|
#include "mt7621_phicomm_k2p.dtsi"
|
||||||
|
|
||||||
&firmware {
|
/ {
|
||||||
reg = <0xa0000 0xf60000>;
|
compatible = "phicomm,k2p", "mediatek,mt7621-soc";
|
||||||
|
model = "Phicomm K2P";
|
||||||
|
};
|
||||||
|
|
||||||
|
&spi0 {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
m25p80@0 {
|
||||||
|
compatible = "jedec,spi-nor";
|
||||||
|
reg = <0>;
|
||||||
|
spi-max-frequency = <10000000>;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
label = "u-boot";
|
||||||
|
reg = <0x0 0x30000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@30000 {
|
||||||
|
label = "u-boot-env";
|
||||||
|
reg = <0x30000 0x10000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
factory: partition@40000 {
|
||||||
|
label = "factory";
|
||||||
|
reg = <0x40000 0x10000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@50000 {
|
||||||
|
label = "permanent_config";
|
||||||
|
reg = <0x50000 0x50000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@a0000 {
|
||||||
|
compatible = "denx,uimage";
|
||||||
|
label = "firmware";
|
||||||
|
reg = <0xa0000 0xf60000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
#include <dt-bindings/input/input.h>
|
#include <dt-bindings/input/input.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "phicomm,k2p", "mediatek,mt7621-soc";
|
|
||||||
model = "Phicomm K2P";
|
|
||||||
|
|
||||||
aliases {
|
aliases {
|
||||||
led-boot = &led_blue;
|
led-boot = &led_blue;
|
||||||
led-failsafe = &led_blue;
|
led-failsafe = &led_blue;
|
||||||
@ -49,52 +46,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&spi0 {
|
|
||||||
status = "okay";
|
|
||||||
|
|
||||||
flash@0 {
|
|
||||||
compatible = "jedec,spi-nor";
|
|
||||||
reg = <0>;
|
|
||||||
spi-max-frequency = <10000000>;
|
|
||||||
|
|
||||||
partitions {
|
|
||||||
compatible = "fixed-partitions";
|
|
||||||
#address-cells = <1>;
|
|
||||||
#size-cells = <1>;
|
|
||||||
|
|
||||||
partition@0 {
|
|
||||||
label = "u-boot";
|
|
||||||
reg = <0x0 0x30000>;
|
|
||||||
read-only;
|
|
||||||
};
|
|
||||||
|
|
||||||
partition@30000 {
|
|
||||||
label = "u-boot-env";
|
|
||||||
reg = <0x30000 0x10000>;
|
|
||||||
read-only;
|
|
||||||
};
|
|
||||||
|
|
||||||
factory: partition@40000 {
|
|
||||||
label = "factory";
|
|
||||||
reg = <0x40000 0x10000>;
|
|
||||||
read-only;
|
|
||||||
};
|
|
||||||
|
|
||||||
partition@50000 {
|
|
||||||
label = "permanent_config";
|
|
||||||
reg = <0x50000 0x50000>;
|
|
||||||
read-only;
|
|
||||||
};
|
|
||||||
|
|
||||||
firmware: partition@a0000 {
|
|
||||||
compatible = "denx,uimage";
|
|
||||||
label = "firmware";
|
|
||||||
reg = <0xa0000 0xf60000>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
&pcie {
|
&pcie {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
@ -825,7 +825,7 @@ define Device/phicomm_k2p-32m
|
|||||||
$(Device/phicomm_k2p)
|
$(Device/phicomm_k2p)
|
||||||
IMAGE_SIZE := 32128k
|
IMAGE_SIZE := 32128k
|
||||||
DEVICE_VARIANT := 32M
|
DEVICE_VARIANT := 32M
|
||||||
SUPPORTED_DEVICES += k2p-32M
|
SUPPORTED_DEVICES += k2p-32m
|
||||||
endef
|
endef
|
||||||
TARGET_DEVICES += phicomm_k2p-32m
|
TARGET_DEVICES += phicomm_k2p-32m
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user