1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge branch 'test' into ipq807x

This commit is contained in:
suyuan 2023-07-23 15:50:49 +08:00
commit bc2d267900
3 changed files with 30 additions and 6 deletions

View file

@ -956,6 +956,18 @@ _vps_firewall_redirect_port() {
[ -n "$src_dip" ] && {
comment=" to $src_dip"
$IPTABLESSAVE --counters | sed "s:-d $src_dip/32::g" | $IPTABLESRESTORE -w
[ -f /usr/sbin/nft ] && {
rule=$(nft -a list table inet fw4 | grep -m1 "ip daddr $src_dip")
[ -n "$rule" ] && {
handle=$(echo $rule | awk '{ print $NF }')
nft replace rule inet fw4 dstnat_lan handle ${handle} $(echo $rule | awk '{ sub(" comment.*$",""); print }' | sed "s/ip daddr ${src_dip}//") 2>&1 >/dev/null
}
rule=$(nft -a list table inet fw4 | grep -m1 "ip daddr $src_dip")
[ -n "$rule" ] && {
handle=$(echo $rule | awk '{ print $NF }')
nft replace rule inet fw4 dstnat_vpn handle $handle $(echo $rule | awk '{ sub(" comment.*$",""); print }' | sed "s/ip daddr ${src_dip}/meta nfproto ipv4/") 2>&1 >/dev/null
}
}
}
[ -n "$src_ip" ] && comment=" from $src_ip"
if [ "$target" = "ACCEPT" ]; then
@ -1038,6 +1050,18 @@ _vps_firewall_redirect_port() {
[ -n "$src_dip" ] && {
comment=" to $src_dip"
$IPTABLESSAVE --counters | sed "s:-d $src_dip/32::g" | $IPTABLESRESTORE -w
[ -f /usr/sbin/nft ] && {
rule=$(nft -a list table inet fw4 | grep -m1 "ip daddr $src_dip")
[ -n "$rule" ] && {
handle=$(echo $rule | awk '{ print $NF }')
nft replace rule inet fw4 dstnat_lan handle ${handle} $(echo $rule | awk '{ sub(" comment.*$",""); print }' | sed "s/ip daddr ${src_dip}//") 2>&1 >/dev/null
}
rule=$(nft -a list table inet fw4 | grep -m1 "ip daddr $src_dip")
[ -n "$rule" ] && {
handle=$(echo $rule | awk '{ print $NF }')
nft replace rule inet fw4 dstnat_vpn handle $handle $(echo $rule | awk '{ sub(" comment.*$",""); print }' | sed "s/ip daddr ${src_dip}/meta nfproto ipv4/") 2>&1 >/dev/null
}
}
}
[ -n "$src_ip" ] && comment=" from $src_ip"
checkfw=$(echo "$vpsfwlist" | grep "# OMR $username open router $src_dport port ${protoi}${comment} --- V2Ray to ${dest_ip}:${dest_port}")

View file

@ -145,11 +145,11 @@ if [ "$(uci -q get glorytun-udp.vpn.key)" = "" ] && [ "$(uci -q get glorytun.vpn
uci -q commit glorytun-udp
fi
if [ "$(uci -q get network.tun0.metric)" = "1200" ] || [ -z "$(uci -q get network.tun0.metric)" ]; then
if [ "$(uci -q get network.tun0.mtu)" = "1200" ] || [ -z "$(uci -q get network.tun0.mtu)" ]; then
uci -q batch <<-EOF >/dev/null
set network.tun0=device
set network.tun0.name='tun0'
set network.tun0.metric=9000
set network.tun0.mtu=9000
commit network
EOF
fi