#!/bin/sh . /lib/functions.sh _set_ttl() { device=$(uci -q get network.$1.name) ttl=$(uci -q get network.$1.ttl) if [ -n "$ttl" ] && [ -z "$(iptables-save | grep TTL | grep $device)" ]; then iptables -w -t mangle -I POSTROUTING -o $device -j TTL --ttl-set $ttl 2>&1 >/dev/null fi } config_load network config_foreach _set_ttl device