X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/108528b2ce6d962e422e1c81e4322eafcb7e4b73..02e3b0f5531da86339e8da86b1f78a9b6aba7f50:/package/base-files/files/lib/network/config.sh diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh index 03d7ca1f7..cf5b197b5 100755 --- a/package/base-files/files/lib/network/config.sh +++ b/package/base-files/files/lib/network/config.sh @@ -9,6 +9,23 @@ do_sysctl() { sysctl -n -e "$1" } +map_sysctls() { + local cfg="$1" + local ifn="$2" + + local fam + for fam in ipv4 ipv6; do + if [ -d /proc/sys/net/$fam ]; then + local key + for key in /proc/sys/net/$fam/*/$ifn/*; do + local val + config_get val "$cfg" "${fam}_${key##*/}" + [ -n "$val" ] && echo -n "$val" > "$key" + done + fi + done +} + find_config() { local iftype device iface ifaces ifn for ifn in $interfaces; do @@ -156,6 +173,9 @@ prepare_interface() { ifconfig "$iface" down ifconfig "$iface" hw ether "$vifmac" up } + + # Apply sysctl settings + map_sysctls "$config" "$iface" } # Setup VLAN interfaces