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

Fix IPv6 support

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-11-08 19:58:04 +01:00
parent 3b9519a542
commit 52b9ed37cf
2 changed files with 22 additions and 13 deletions

View file

@ -22,7 +22,7 @@ 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)" = "" ]; then
if [ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ] || [ "$(ip -6 route show default | 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

@ -44,6 +44,11 @@ set_ipv6_state() {
EOF
config_load shadowsocks-libev
config_foreach set_shadowsocks_address ss_redir "0.0.0.0"
uci -q batch <<-EOF >/dev/null
commit network
commit dhcp
commit shadowsocks-libev
EOF
else
logger -t "omr-6in4" "Enable IPv6"
uci -q batch <<-EOF >/dev/null
@ -57,14 +62,9 @@ set_ipv6_state() {
add_list dhcp.lan.ra_flags='other-config'
set network.lan.ipv6="1"
set network.lan.delegate="0"
set network.omr6in4.force_link=1
delete network.omr6in4.auto
EOF
if [ "$(uci -q get v2ray.main.inbounds | grep omr6)" = "" ]; then
uci -q batch <<-EOF >/dev/null
add_list v2ray.main.inbounds="omr6"
commit v2ray
EOF
fi
if [ "$(network.lan.ip6assign)" = "" ]; then
uci -q set network.lan.ip6assign='60'
fi
@ -77,12 +77,20 @@ set_ipv6_state() {
config_load shadowsocks-libev
config_foreach set_shadowsocks_address ss_redir "::"
uci -q batch <<-EOF >/dev/null
commit network
commit dhcp
commit shadowsocks-libev
EOF
/etc/init.d/shadowsocks-libev restart
if [ "$(uci -q get v2ray.main.inbounds | grep omr6)" = "" ]; then
uci -q batch <<-EOF >/dev/null
add_list v2ray.main.inbounds="omr6"
commit v2ray
EOF
/etc/init.d/v2ray restart
fi
fi
uci -q batch <<-EOF >/dev/null
commit network
commit dhcp
commit shadowsocks-libev
EOF
/etc/init.d/odhcpd restart
if [ "$previous" != "1" ]; then
env -i /bin/ubus call network reload
@ -98,6 +106,7 @@ start_service() {
}
[ "$(ifstatus omr6in4 | jsonfilter -e '@.up' | tr -d '\n')" != "true" ] && ifup omr6in4
multipath 6in4-omr6in4 off 2>&1 >/dev/null
procd_open_instance
# shellcheck disable=SC2086
procd_set_param command /bin/omr-6in4