aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/network
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
commite2bee034253d9998d6d9ad2c9788cc5eccc40176 (patch)
treec3ab8686a5f10f75dd68b19d49ccb2474e6e5b05 /package/base-files/files/lib/network
parent2c71b3ff3edd37a1971e7cb2776d49d2c90de257 (diff)
downloadmaster-187ad058-e2bee034253d9998d6d9ad2c9788cc5eccc40176.tar.gz
master-187ad058-e2bee034253d9998d6d9ad2c9788cc5eccc40176.tar.bz2
master-187ad058-e2bee034253d9998d6d9ad2c9788cc5eccc40176.zip
[package] 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. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27653 3c298f89-4303-0410-b956-a3cf2f4a3e73
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