~Tailscale通告网段改为使用透明路由ipv4网段

~bug fix
This commit is contained in:
juewuy
2026-01-08 17:31:17 +08:00
parent f72192e801
commit d98f6ccef5
4 changed files with 14 additions and 6 deletions

View File

@@ -2,7 +2,10 @@
# Copyright (C) Juewuy
[ "$ts_service" = ON ] && {
[ "$ts_subnet" = true ] && advertise_routes='"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"'
[ "$ts_subnet" = true ] && {
. "$CRASHDIR"/starts/fw_getlanip.sh && getlanip
advertise_routes=$(echo "$host_ipv4"|sed 's/[[:space:]]\+/", "/g; s/^/"/; s/$/"/')
}
[ -z "$ts_exit_node" ] && ts_exit_node=false
[ -z "$ts_hostname" ] && ts_hostname='ShellCrash'
cat >"$TMPDIR"/jsons/tailscale.json <<EOF

View File

@@ -84,7 +84,12 @@ set_dns_mod() { #DNS模式设置
dns_redir_port="$dns_port"
setconfig dns_redir_port
elif [ "$num" -lt 65535 -a "$num" -ge 1 ];then
if [ -n "$(netstat -ntul | grep -E ":$num[[:space:]]")" ];then
if ckcmd netstat;then
port_test=$(netstat -ntul | grep -E ":$num[[:space:]]")
else
port_test=0
fi
if [ -n "$port_test" ];then
dns_redir_port="$num"
setconfig dns_redir_port "$dns_redir_port"
else

View File

@@ -16,13 +16,13 @@
. "$CRASHDIR"/libs/web_save.sh
#特殊脚本
bfstart(){
. "$CRASHDIR"/starts/bfstart.sh
"$CRASHDIR"/starts/bfstart.sh
}
afstart(){
. "$CRASHDIR"/starts/afstart.sh
"$CRASHDIR"/starts/afstart.sh
}
stop_firewall(){
. "$CRASHDIR"/starts/fw_stop.sh
"$CRASHDIR"/starts/fw_stop.sh
}
#保守模式启动
start_l(){

View File

@@ -2,7 +2,7 @@
getlanip() { #获取局域网host地址
i=1
while [ "$i" -le "20" ]; do
host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Ev 'utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g') #ipv4局域网网段
host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Ev 'utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/[[:space:]]br.*$//g' | sed 's/metric.*$//g') #ipv4局域网网段
[ "$ipv6_redir" = "ON" ] && host_ipv6=$(ip a 2>&1 | grep -w 'inet6' | grep -E 'global' | sed 's/.*inet6.//g' | sed 's/scope.*$//g') #ipv6公网地址段
[ -f "$TMPDIR"/ShellCrash.log ] && break
[ -n "$host_ipv4" -a "$ipv6_redir" != "ON" ] && break