summaryrefslogtreecommitdiffhomepage
path: root/contrib/package
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2012-06-02 20:44:58 +0000
committerManuel Munz <freifunk@somakoma.de>2012-06-02 20:44:58 +0000
commit5ff3e0d7ba083c08c7ff57ffabf6f6d3865fac90 (patch)
tree7024dcfcccfdbabc570093b5da54e584bc5beff2 /contrib/package
parent09f83d2edfe7b98ad9f76688e4afac2ec0651b07 (diff)
contrib/meshwizard: Add initial support for ipv6 config (with auto-ipv6-ib and dhcpv6)
Diffstat (limited to 'contrib/package')
-rw-r--r--contrib/package/meshwizard/Makefile2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh7
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh13
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh3
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh12
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh20
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh13
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh18
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.conf12
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh10
10 files changed, 106 insertions, 4 deletions
diff --git a/contrib/package/meshwizard/Makefile b/contrib/package/meshwizard/Makefile
index 8cebf170d..73f018595 100644
--- a/contrib/package/meshwizard/Makefile
+++ b/contrib/package/meshwizard/Makefile
@@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=meshwizard
-PKG_RELEASE:=0.0.6
+PKG_RELEASE:=0.0.7
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
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
new file mode 100755
index 000000000..e10677cc9
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+local PREFIX="$(echo $profile_ipv6_prefix| cut -d "/" -f 1| sed 's/::/:/')"
+local MAC="$(ifconfig $1 |grep HWaddr | awk '{ print $5 '})"
+local IPV6_UNIQ="$(echo $MAC | awk -F: '{ print $1$2":"$3$4":"$5$6 }')"
+
+echo "${PREFIX}${IPV6_UNIQ}:1"
+
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
new file mode 100755
index 000000000..edbbbc418
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. $dir/functions.sh
+
+# Setup auto-ipv6
+
+if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+ uci set autoipv6.olsr_node.enable=1
+ uci_commitverbose "Setup auto-ipv6 for dhcpv6 mode" autoipv6
+fi
+
+
+
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 2b32f24ab..504aaee80 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,6 +21,9 @@ 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
+ uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr.ipv6"
+ fi
fi
uci_commitverbose "Setup dnsmasq" dhcp
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 36455a7ac..e14a384e3 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
@@ -97,4 +97,16 @@ for config in freifunk profile_$community; do
config_foreach handle_firewall $section
done
done
+
+# If we use auto-ipv6-dhcp then allow 547/udp on the freifunk zone
+if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+ uci batch <<- EOF
+ firewall.dhcpv6=rule
+ firewall.dhcpv6.src=freifunk
+ firewall.dhcpv6.target=ACCEPT
+ firewall.dhcpv6.dest_port=547
+ firewall.dhcpv6.proto=udp
+ EOF
+fi
+
uci_commitverbose "Setup rules, forwardings, advanced config and includes." firewall
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
new file mode 100755
index 000000000..00f070682
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+[ ! "$(uci -q get network.lan)" == "interface" ] && exit
+
+. /etc/functions.sh
+. $dir/functions.sh
+
+# Setup IPv6 for the lan interface
+
+local ip6addr=""
+if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+ # get lan mac
+ local device="$(uci -p/var/state -q get network.lan.ifname)"
+ if [ -n "device" ]; then
+ ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $device)"
+ fi
+ uci set network.lan.ip6addr="${ip6addr}/112"
+fi
+
+uci_commitverbose "Setup ipv6 address for lan" network
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 1215c95a4..fc3ca9d1b 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
@@ -23,6 +23,19 @@ uci batch << EOF
set network.$netrenamed.netmask="$netmask"
EOF
+# Setup IPv6 for the interface
+local ip6addr
+if [ "$profile_ipv6" = 1 ]; then
+ if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+ # get interface mac
+ local device="$(uci -p/var/state -q get network.$netrenamed.ifname)"
+ if [ -n "device" ]; then
+ ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $device)"
+ fi
+ uci set network.$netrenamed.ip6addr="${ip6addr}/112"
+ fi
+fi
+
uci_commitverbose "Setup interface $netrenamed" network
# setup dhcp alias/interface
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 10b1afff8..f7ba95e86 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
@@ -4,16 +4,30 @@
. /etc/functions.sh
. $dir/functions.sh
-# Rename interface defaults
+#Rename olsrd basic settings
+handle_olsrd() {
+ if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
+ section_rename olsrd $1 olsrd
+ fi
+}
+config_load olsrd
+config_foreach handle_olsrd olsrd
+# Rename interface defaults
handle_interfacedefaults() {
if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
section_rename olsrd $1 InterfaceDefaults
fi
}
-config_load olsrd
config_foreach handle_interfacedefaults InterfaceDefaults
+# Set basic olsrd settings
+if [ "profile_ipv6" = 1 ]; then
+ uci set olsrd.olsrd.IpVersion="6and4"
+fi
+uci_commitverbose "Setup olsr basic settings" olsrd
+
+
# Setup new InterfaceDefaults
uci set olsrd.InterfaceDefaults=InterfaceDefaults
set_defaults "olsr_interfacedefaults_" olsrd.InterfaceDefaults
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.conf
new file mode 100755
index 000000000..0ab19aea8
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.conf
@@ -0,0 +1,12 @@
+#!/bin/sh
+. $dir/functions.sh
+
+if [ "$profile_ipv6" = 1 ]; then
+ uci batch <<- EOF
+ set uhttpd.main.listen_http=":80"
+ set uhttpd.main.listen_https=:"443"
+ EOF
+fi
+
+uci_commitverbose "Setup uhttpd" uhttpd
+
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
index f58253bcc..33ef0b027 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
@@ -12,7 +12,7 @@
. /etc/functions.sh
echo "
-/* Meshwizard 0.0.4 */
+/* Meshwizard 0.0.7 */
"
# config
@@ -67,6 +67,14 @@ if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask"
$dir/helpers/setup_lan_static.sh
fi
+if [ "$profile_ipv6" == 1 ]; then
+ $dir/helpers/setup_lan_ipv6.sh
+ # Setup auto-ipv6
+ if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+ $dir/helpers/setup_auto-ipv6.sh
+ fi
+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