mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Update TTL settings to nftables
This commit is contained in:
parent
ebce49935a
commit
d11f409225
2 changed files with 9 additions and 3 deletions
|
@ -5,8 +5,12 @@
|
|||
_set_ttl() {
|
||||
device=$(uci -q get network.$1.name)
|
||||
ttl=$(uci -q get network.$1.ttl)
|
||||
if [ -n "$ttl" ] && [ -z "$(iptables-save 2>/dev/null | grep TTL | grep $device)" ]; then
|
||||
iptables -w -t mangle -I POSTROUTING -o $device -j TTL --ttl-set $ttl 2>&1 >/dev/null
|
||||
if [ -n "$ttl" ]; then
|
||||
if [ -e /usr/sbin/iptables-nft ] && [ -z "$(nft list ruleset 2>/dev/null | grep ttl | grep $device)" ]; then
|
||||
nft add rule inet fw4 mangle_forward oifname $device ip ttl set $ttl >/dev/null 2>&1
|
||||
elif [ ! -e /usr/sbin/iptables-nft ] && [ -z "$(iptables-save 2>/dev/null | grep TTL | grep $device)" ]; then
|
||||
iptables -w -t mangle -I POSTROUTING -o $device -j TTL --ttl-set $ttl >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue