summaryrefslogtreecommitdiff
path: root/package/base-files/files/lib/network
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/lib/network')
-rwxr-xr-xpackage/base-files/files/lib/network/config.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh
index 03d7ca1f7a..cf5b197b59 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