contrib/meshwizard: Add initial support for ipv6 config (with auto-ipv6-ib and dhcpv6)
This commit is contained in:
parent
09f83d2edf
commit
5ff3e0d7ba
10 changed files with 106 additions and 4 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue