summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/meshwizard/files
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-10-29 21:19:05 +0000
committerManuel Munz <freifunk@somakoma.de>2011-10-29 21:19:05 +0000
commitc123f7299f882e2e24c1fc8677bf7896145dddb0 (patch)
treebd2f18f0cc2495693c751e56c786c90d639a6804 /contrib/package/meshwizard/files
parent785cba5563414167fd4d8d4cc63a84b02fa53cda (diff)
contrib/meshwizard: Enable policyrouting when internet sharing is not enabled
Diffstat (limited to 'contrib/package/meshwizard/files')
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh3
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh11
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh7
4 files changed, 20 insertions, 3 deletions
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh
index f58af2421..69fd48b92 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh
@@ -20,6 +20,6 @@ for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_
done
# read values from meshwizard
-for v in system luci_main contact community wan lan; do
+for v in system luci_main contact community wan lan general; do
get_var meshwizard.$v
done
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
index b4de9ce19..f06156a5f 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
@@ -50,9 +50,8 @@ uci_commitverbose "Setup olsr nameservice plugin" olsrd
# Setup dyngw_plain
# If Sharing of Internet is enabled then enable dyngw_plain plugin
-sharenet=$(uci -q get meshwizard.general.sharenet)
-if [ "$sharenet" == 1 ]; then
+if [ "$general_sharenet" == 1 ]; then
uci set olsrd.dyngw_plain=LoadPlugin
uci set olsrd.dyngw_plain.ignore=0
uci set olsrd.dyngw_plain.library="olsrd_dyn_gw_plain.so.0.4"
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh
new file mode 100755
index 000000000..f898bd684
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. $dir/functions.sh
+
+uci batch << EOF
+ set freifunk-policyrouting.pr.enable=1
+ set freifunk-policyrouting.pr.strict=1
+ set freifunk-policyrouting.pr.zones="freifunk"
+EOF
+
+uci_commitverbose "Setup policyrouting" freifunk-policyrouting
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
index 7d389a20f..73eddc4df 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
@@ -67,6 +67,13 @@ if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask"
$dir/helpers/setup_lan_static.sh
fi
+# Setup policyrouting if internet sharing is disabled and wan is not used for olsrd
+# Always disable it first to make sure its disabled when the user decied to share his internet
+uci set freifunk-policyrouting.pr.enable=0
+if [ ! "$sharenet" == 1 ] && [ ! "$(uci -q get meshwizard.netconfig.wan_proto)" == "olsr" ]; then
+ $dir/helpers/setup_policyrouting.sh
+fi
+
# Configure found networks
for net in $networks; do
# radioX devices need to be renamed