From 3630960e71044118804d6057732d0a9e52287f17 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 17 Jul 2011 17:10:30 +0000 Subject: [PATCH] [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. SVN-Revision: 27653 --- package/base-files/Makefile | 2 +- .../base-files/files/lib/network/config.sh | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index d537ed3c17..9cac1f058b 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=base-files -PKG_RELEASE:=75 +PKG_RELEASE:=76 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ PKG_BUILD_DEPENDS:=opkg/host 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 -- 2.30.2