1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 10:31:51 +00:00

Fixes on omr-6in4

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-06-26 14:48:38 +02:00
parent 39507bd661
commit 56e83988e5
2 changed files with 10 additions and 5 deletions

View file

@ -26,7 +26,8 @@ while true; do
[ -z "$peer" ] && peer=$(ip -4 r list dev $iface | grep via | grep -v default | grep -v metric | grep -v / | awk '{print $1; exit}' | tr -d "\n")
[ -z "$peer" ] && peer=$(ip -4 r list dev $iface | grep kernel | awk '/proto kernel/ {print $1}' | grep -v / | tr -d "\n")
[ -n "$addr" ] && [ -n "$peer" ] && {
if ([ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ]) && [ "$(ip -6 route show default dev 6in4-omr6in4 metric 1 | grep via)" = "" ]; then
logger -t "omr6in4" "addr: $addr - peer: $peer"
if [ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ] || [ "$(ip -6 route show default dev 6in4-omr6in4 metric 1 | grep via)" = "" ]; then
logger -t "omr6in4" "Set network for OMR 6in4 to local $addr peer $peer"
uci -q batch <<-EOF
set network.omr6in4.ipaddr=$addr

View file

@ -37,12 +37,14 @@ set_ipv6_state() {
logger -t "omr-6in4" "Disable IPv6"
if [ "$disable_6in4" != "1" ]; then
uci -q batch <<-EOF >/dev/null
set unbound.@unbound[-1].protocol='ip4_only'
commit unbound
del_list v2ray.main.inbounds="omr6"
commit v2ray
EOF
fi
uci -q batch <<-EOF >/dev/null
set unbound.@unbound[-1].protocol='ip4_only'
commit unbound
EOF
config_load shadowsocks-libev
config_foreach set_shadowsocks_address ss_redir "0.0.0.0"
config_load shadowsocks-rust
@ -60,8 +62,6 @@ set_ipv6_state() {
set network.omr6in4.force_link=1
set network.omr6in4.metric=1
delete network.omr6in4.auto
set unbound.@unbound[-1].protocol='mixed'
commit unbound
EOF
if [ "$(uci -q get network.globals.ula_prefix)" = "" ]; then
r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"')
@ -70,6 +70,10 @@ set_ipv6_state() {
uci -q set network.globals.ula_prefix=fd$r1:$r2:$r3::/48
fi
fi
uci -q batch <<-EOF >/dev/null
set unbound.@unbound[-1].protocol='mixed'
commit unbound
EOF
config_load shadowsocks-libev
config_foreach set_shadowsocks_address ss_redir "::"
config_load shadowsocks-rust