summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2012-08-15 12:33:33 +0000
committerManuel Munz <freifunk@somakoma.de>2012-08-15 12:33:33 +0000
commit366c3cd9cc83e34d1e24261e02a9e7f02b6f5b71 (patch)
tree54b21fb100ee295d68188ff5c81af16d60e9d268
parente627e614d8d662d6a147ffbe7ae6a3f3dac1be71 (diff)
meshwizard: ipv6 fixes, fix uhttpd setup
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh6
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh6
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh14
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh (renamed from contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.conf)3
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh7
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh7
12 files changed, 38 insertions, 17 deletions
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
index 114c8f9c1..ca623dbca 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
@@ -1,7 +1,7 @@
#!/bin/sh
netrenamed=$1
-local PREFIX="$(echo $profile_ipv6_prefix| cut -d "/" -f 1| sed 's/::/:/')"
+local PREFIX="$(echo $ipv6_prefix| cut -d "/" -f 1| sed 's/::/:/')"
# Get the devices mac address
local device="$(uci -p/var/state -q get network.$1.ifname)"
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 f5b4943b8..fe8410116 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
@@ -6,7 +6,7 @@ community="$1"
# reads variables from uci files, parameter $1 is the section
get_var() {
- uci -q show $1 | cut -d "." -f 2-100 |grep "\." | sed -e 's/^\([a-z_]*\)\./\1_/g' -e 's/=\(.*\)$/="\1"/g'
+ uci -q show $1 | cut -d "." -f 2-100 |grep "\." | sed -e 's/^\([A-Za-z0-9_]*\)\./\1_/g' -e 's/=\(.*\)$/="\1"/g'
}
# read default values from /etc/config/freifunk
@@ -15,11 +15,11 @@ for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_
done
# now read all values from the selected community profile, will override some values from the defaults before
-for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults profile zone_freifunk include luci_splash; do
+for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults profile zone_freifunk include luci_splash ipv6; do
get_var profile_$community.$v
done
# read values from meshwizard
-for v in system luci_main contact community wan lan general; do
+for v in system luci_main contact community wan lan general ipv6; do
get_var meshwizard.$v
done
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh
index 5be4a3e61..8e3f015cd 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh
@@ -2,7 +2,7 @@
. $dir/functions.sh
-if [ "$profile_ipv6_config" = "auto-ipv6-fromv4" ]; then
+if [ "$ipv6_config" = "auto-ipv6-fromv4" ]; then
mode="fromv4"
else
mode="random"
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
index 59b7f845b..9297f9175 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
@@ -21,7 +21,7 @@ EOF
config_get addnhosts dnsmasq addnhosts
if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then
uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr"
- if [ "$profile_ipv6" = 1 ]; then
+ if [ "$ipv6_enabled" = 1 ]; then
uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr.ipv6"
fi
fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
index 7eceb5088..bf4724112 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
@@ -99,7 +99,7 @@ for config in freifunk profile_$community; do
done
# If we use auto-ipv6-dhcp then allow 547/udp on the freifunk zone
-if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
uci batch <<- EOF
set firewall.dhcpv6=rule
set firewall.dhcpv6.src=freifunk
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh
index 1b6e0dee3..2f6144b67 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh
@@ -8,7 +8,7 @@
# Setup IPv6 for the lan interface
local ip6addr=""
-if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
# get lan mac
local device="$(uci -p/var/state -q get network.lan.ifname)"
if [ -n "device" ]; then
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
index 8c909e2d5..325475fa6 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
@@ -26,12 +26,12 @@ EOF
# Setup IPv6 for the interface
local ip6addr
-if [ "$profile_ipv6" = 1 ]; then
- if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+if [ "$ipv6_enabled" = 1 ]; then
+ if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $netrenamed)"
uci set network.$netrenamed.ip6addr="${ip6addr}/112"
fi
- if [ "$profile_ipv6_config" = "static" ] && [ -n "$ip6addr" ]; then
+ if [ "$ipv6_config" = "static" ] && [ -n "$ip6addr" ]; then
uci set network.$netrenamed.ip6addr="$ip6addr"
fi
fi
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 2d9e74c7b..f97aad6f4 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
@@ -31,7 +31,7 @@ handle_interfacedefaults() {
config_foreach handle_interfacedefaults InterfaceDefaults
# Set basic olsrd settings
-if [ "$profile_ipv6" = 1 ] && [ "$has_ipv6" == "1" ]; then
+if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
uci set olsrd.olsrd.IpVersion="6and4"
fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh
index 6bb490adf..edb5eea43 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh
@@ -44,3 +44,17 @@ if [ -n "$dhcprange" ]; then
uci_commitverbose "Setup HNA for network $dhcprange" olsrd
fi
fi
+
+# Set Hna entry for ipv6 net for static ipv6 config
+uci -q delete olsrd.${netrenamed}static
+if [ "$ipv6_enabled" = "1" ] && [ "$ipv6_config" = "static" ]; then
+ local v6range="$(uci -q get meshwizard.netconfig.$net\_ip6addr)"
+ local v6net="$(echo $v6range | cut -d '/' -f 1)"
+ local v6mask="$(echo $v6range | cut -d '/' -f 2)"
+ if [ -n "$v6net" ] && [ -n "$v6mask" ]; then
+ uci set olsrd.${netrenamed}static="Hna6"
+ uci set olsrd.${netrenamed}static.netaddr="$v6net"
+ uci set olsrd.${netrenamed}static.prefix="$v6mask"
+ uci_commitverbose "Setup HNA for network $v6range" olsrd
+ fi
+fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.conf b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh
index 0ab19aea8..172e41477 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.conf
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh
@@ -1,7 +1,6 @@
#!/bin/sh
. $dir/functions.sh
-
-if [ "$profile_ipv6" = 1 ]; then
+if [ "$ipv6_enabled" = "1" ]; then
uci batch <<- EOF
set uhttpd.main.listen_http=":80"
set uhttpd.main.listen_https=:"443"
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
index 98b941b84..91fc1d8da 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
@@ -1,11 +1,18 @@
#!/bin/sh
# Setup dhcp interface settings for wan. This is the OpenWrt default,
# so all we need to do here is to delete wan from meshwizard after setup.
+# Also disallow ra on wan if ipv6 is enabled
[ ! "$(uci -q get network.wan)" == "interface" ] && exit
. /lib/functions.sh
. $dir/functions.sh
+if [ "$ipv6_enabled" = "1" ]; then
+ uci set network.wan.accept_ra='0'
+ uci_commitverbose "Do not accept ra on wan interface" network
+fi
+
+
uci delete meshwizard.wan && uci commit meshwizard
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
index f6b227dce..41a6117ea 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
@@ -60,6 +60,7 @@ $dir/helpers/setup_system.sh
$dir/helpers/setup_olsrd.sh
$dir/helpers/setup_firewall.sh
$dir/helpers/setup_ssh.sh
+$dir/helpers/setup_uhttpd.sh
if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
$dir/helpers/setup_wan_static.sh
@@ -73,10 +74,10 @@ if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask"
$dir/helpers/setup_lan_static.sh
fi
-if [ "$profile_ipv6" == 1 ] && [ "$has_ipv6" = 1 ]; then
+if [ "$ipv6_enabled" == 1 ] && [ "$has_ipv6" = 1 ]; then
$dir/helpers/setup_lan_ipv6.sh
# Setup auto-ipv6
- if [ -n "$(echo "$profile_ipv6_config" |grep auto-ipv6)" ]; then
+ if [ -n "$(echo "$ipv6_config" |grep auto-ipv6)" ]; then
$dir/helpers/setup_auto-ipv6.sh
fi
fi
@@ -107,7 +108,7 @@ for net in $networks; do
$dir/helpers/setup_splash.sh $net
$dir/helpers/setup_firewall_interface.sh $net
- if [ -n "$(echo "$profile_ipv6_config" |grep auto-ipv6)" ]; then
+ if [ -n "$(echo "$ipv6_config" |grep auto-ipv6)" ]; then
$dir/helpers/setup_auto-ipv6-interface.sh $net
fi
done