include $(TOPDIR)/rules.mk
PKG_NAME:=meshwizard
-PKG_RELEASE:=0.3.0
+PKG_RELEASE:=0.3.1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then
uci batch <<- EOF
set dhcp.${netrenamed}dhcp="dhcp"
+ set dhcp.${netrenamed}dhcp.ignore="0"
set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp"
EOF
set_defaults "dhcp_" dhcp.${netrenamed}dhcp
fi
ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
-if [ "$supports_vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then
+if [ "$supports_vap" = 0 ] || \
+ [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
+ [ "$lan_is_olsr" = "1" -a "$lan_dhcp" = 1 ]; then
uci batch <<- EOF
set dhcp.${netrenamed}ahdhcp="dhcp"
+ set dhcp.${netrenamed}ahdhcp.ignore="0"
set dhcp.${netrenamed}ahdhcp.interface="${netrenamed}ahdhcp"
EOF
fi
. $dir/functions.sh
wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config)
-lan_is_olsr=$(uci -q get meshwizard.netconfig.lan_config)
config_load firewall
fi
fi
- if [ "$name" == "lan" ] && [ "$lan_is_olsr" == 1 ]; then
+ if [ "$name" == "lan" ] && [ "$lan_is_olsr" == "1" ]; then
uci set firewall.$1.network=' ' && uci_commitverbose "LAN is used for olsr, removed the lan interface from zone lan" firewall
fi
}
# setup entry in /etc/config/network for a interface
# Argument $1: network interface
-
+
net="$1"
. /lib/functions.sh
. $dir/functions.sh
set network.$netrenamed.netmask="$netmask"
EOF
+if [ "$netrenamed" = "lan" ]; then
+ # remove the bridge if the interface is used for olsr
+ # since this script is only run in this case, no need
+ # to check for lan_proto = "olsr" currently.
+ uci -q delete network.lan.type
+fi
+
# Setup IPv6 for the interface
local ip6addr
if [ "$ipv6_enabled" = 1 ]; then
# Setup alias for $net adhoc interface
- if [ "$supports_vap" = 0 ] || [ "$vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then
- # vaps are either not supported or enabled or they are supported and enabled
- # but we also want to use DHCP on the adhoc interface
+ if [ "$supports_vap" = 0 ] || \
+ [ "$vap" = 0 ] || \
+ [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
+ [ "$lan_is_olsr" = "1" ]; then
+ # setup an alias interface for the main interface to use as a network for clients
+ # when one of the following conditions is met
+ # * vaps are not supported
+ # * or not enabled
+ # * or they are supported and enabled but we also want to use DHCP on the adhoc interface
+ # * or this is the lan interface and it is used for olsrd (and dhcp is enabled)
uci batch <<- EOF
set network.${netrenamed}ahdhcp=interface
set network.${netrenamed}ahdhcp.ifname="@${netrenamed}"
set network.${netrenamed}ahdhcp.ipaddr="$STARTADHOC"
set network.${netrenamed}ahdhcp.netmask="$NETMASKADHOC"
EOF
+ uci_commitverbose "Setup interface for ${netrenamed}ahdhcp" network
fi
- uci_commitverbose "Setup interface for ${netrenamed}ahdhcp" network
fi
EOF
}
-if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" == 1 ] && [ -n "$dhcprange" ]; then
+if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" = 1 ] && [ -n "$dhcprange" ]; then
handle_splash() {
config_get network "$1" network
if [ "$network" == "${netrenamed}dhcp" ]; then
config_foreach handle_splash iface
if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then
- splash_net_add ${netrenamed}dhcp
+ splash_net_add ${netrenamed}dhcp
uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
fi
ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
- if [ "$supports_vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then
- splash_net_add ${netrenamed}ahdhcp
+ if [ "$supports_vap" = 0 ] || \
+ [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
+ [ "$lan_dhcp" = 1 ]; then
+ splash_net_add ${netrenamed}ahdhcp
uci_commitverbose "Setup dhcpsplash for ${netrenamed}ahdhcp" luci_splash
fi
/etc/init.d/luci_splash enable
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
echo "
-/* Meshwizard 0.3.0 */
+/* Meshwizard 0.3.1 */
"
# config
# Rename wifi interfaces
$dir/helpers/rename-wifi.sh
+export lan_is_olsr="$(uci -q get meshwizard.netconfig.lan_config)"
+
# Get community
community="$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name)"
[ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1
$dir/helpers/setup_olsrd_interface.sh $net
net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp)
+ export ${net}_dhcp=$net_dhcp
+
+ if [ "$net" = "lan" ] && [ "$lan_is_olsr" = "1" ]; then
+ uci -q set dhcp.lan.ignore="1"
+ uci_commitverbose "Disable DHCP on LAN because it is an olsr interface." dhcp
+ fi
+
if [ "$net_dhcp" == 1 ]; then
$dir/helpers/setup_dhcp.sh $net
fi