summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-07-17 17:10:30 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-07-17 17:10:30 +0000
commit0de28706ca0d805f0a5b57494baba23a29ce5d27 (patch)
tree624b5bb19454f6f2f46d75b4f8b6f72d7558ccf2 /package/base-files/files
parent1267f048da73ecb16cb98571657b6de2f3811f19 (diff)
downloadmtk-20170518-0de28706ca0d805f0a5b57494baba23a29ce5d27.zip
mtk-20170518-0de28706ca0d805f0a5b57494baba23a29ce5d27.tar.gz
mtk-20170518-0de28706ca0d805f0a5b57494baba23a29ce5d27.tar.bz2
base-files: implement a generic mechanism to map per-interface sysctls to uci. - option ipv4_xyz is mapped to /proc/sys/net/ipv4/{conf,neigh}/xyz - option ipv6_xyz is mapped to /proc/sys/net/ipv6/{conf,neigh}/xyz This allows e.g. "option ipv6_proxy_ndp 1" to enable NDP proxying on wan. Fixes ticket #8699.
SVN-Revision: 27653
Diffstat (limited to 'package/base-files/files')
-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 03d7ca1..cf5b197 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