+do_sysctl() {
+ [ -n "$2" ] && \
+ sysctl -n -e -w "$1=$2" >/dev/null || \
+ 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
+}
+