mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 11:01:50 +00:00
18 lines
No EOL
603 B
Turtle
18 lines
No EOL
603 B
Turtle
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
_set_ttl() {
|
|
device=$(uci -q get network.$1.name)
|
|
ttl=$(uci -q get network.$1.ttl)
|
|
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
|
|
}
|
|
|
|
config_load network
|
|
config_foreach _set_ttl device |