This commit is contained in:
lean 2020-12-24 21:32:20 +08:00
commit dd9feccea4
6 changed files with 421 additions and 375 deletions

View File

@ -20,28 +20,29 @@ pdnsd_genconfig() {
chown -R nobody.nogroup /var/dnscache
fi
cat > /var/etc/dnscache.conf <<EOF
cat <<-EOF >/var/etc/dnscache.conf
global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置
pid_file = /var/run/dnscache.pid;
server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
run_as="nobody";
server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
status_ctl = on;
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
query_method=udp_only;
neg_domain_pol = off;
par_queries = 400; # 最多同时请求数
min_ttl = 1h; # DNS结果最短缓存时间
max_ttl = 1w; # DNS结果最长缓存时间
timeout = 10; # DNS请求超时时间单位秒
par_queries = 400; # 最多同时请求数
min_ttl = 1h; # DNS结果最短缓存时间
max_ttl = 1w; # DNS结果最长缓存时间
timeout = 10; # DNS请求超时时间单位秒
}
server {
label = "routine";
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
74.125.155.102,
74.125.39.102,
74.125.39.113,
@ -104,9 +105,9 @@ server {
}
server {
label = "special"; # 这个随便写
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
label = "special"; # 这个随便写
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
proxy_only = on;
timeout = 5;
}
@ -127,7 +128,7 @@ rr {
EOF
[ -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"
}
@ -162,6 +163,8 @@ start_service(){
procd_set_param stderr 1
procd_close_instance
change_dns
else
revert_dns
fi
if [ $bbr -eq 1 ]; then
sysctl -w net.ipv4.tcp_congestion_control=bbr
@ -196,4 +199,3 @@ restart(){
/etc/init.d/dnsmasq restart && echo "DNSMASQ restart"
/etc/init.d/firewall restart >/dev/null 2>&1
}

View File

@ -20,11 +20,12 @@ pdnsd_genconfig() {
chown -R nobody.nogroup /var/dnscache
fi
cat > /var/etc/dnscache.conf <<EOF
cat <<-EOF >/var/etc/dnscache.conf
global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
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_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
status_ctl = on;
@ -127,7 +128,7 @@ rr {
EOF
[ -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() {
@ -177,6 +178,8 @@ start_service() {
procd_set_param stderr 1
procd_close_instance
change_dns
else
revert_dns
fi
if [ $bbr -eq 1 ]; then

View File

@ -1,12 +1,55 @@
/dts-v1/;
#include "mt7621_phicomm_k2p_default.dtsi"
#include "mt7621_phicomm_k2p.dtsi"
/ {
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>;
};
};
};
};

View File

@ -1,7 +1,54 @@
/dts-v1/;
#include "mt7621_phicomm_k2p_default.dtsi"
#include "mt7621_phicomm_k2p.dtsi"
&firmware {
/ {
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>;
};
};
};
};

View File

@ -5,9 +5,6 @@
#include <dt-bindings/input/input.h>
/ {
compatible = "phicomm,k2p", "mediatek,mt7621-soc";
model = "Phicomm K2P";
aliases {
led-boot = &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 {
status = "okay";
};

View File

@ -825,7 +825,7 @@ define Device/phicomm_k2p-32m
$(Device/phicomm_k2p)
IMAGE_SIZE := 32128k
DEVICE_VARIANT := 32M
SUPPORTED_DEVICES += k2p-32M
SUPPORTED_DEVICES += k2p-32m
endef
TARGET_DEVICES += phicomm_k2p-32m