Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes on omr-6in4 #507

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion omr-6in4/files/bin/omr-6in4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions omr-6in4/files/etc/init.d/omr-6in4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"')
Expand All @@ -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
Expand Down