Index: luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
===================================================================
--- luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh	(revision 7228)
+++ luci/branches/luci-0.10/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh	(revision 7810)
@@ -1,13 +1,8 @@
 # setup entry in /etc/config/network for a interface
 # Argument $1: network interface
-
+ 
 net="$1"
 . /etc/functions.sh
 . $dir/functions.sh
-
-# Delete the network interface section for $net
-if [ "$cleanup" == 1 ]; then
-	section_cleanup network.$netrenamed
-fi
 
 # Setup a (new) interface section for $net
@@ -16,16 +11,18 @@
 [ -z "$ipaddr" ] && msg_missing_value meshwizard $net\_ip4addr
 
-[ -z "$interface_netmask" ] && interface netmask="255.255.0.0"
+netmask=$(uci -q get meshwizard.netconfig.$net\_netmask)
+[ -z "$netmask" ] && netmask="$interface_netmask"
+[ -z "$netmask" ] && netmask="255.255.0.0"
+
+uci set network.$netrenamed="interface"
+set_defaults "interface_" network.$netrenamed
 
 uci batch << EOF
-set network.$netrenamed="interface"
-set network.$netrenamed.proto="static"
-set network.$netrenamed.ipaddr="$ipaddr"
-set network.$netrenamed.netmask="$interface_netmask"
-set network.$netrenamed.dns="$interface_dns"
+	set network.$netrenamed.proto="static"
+	set network.$netrenamed.ipaddr="$ipaddr"
+	set network.$netrenamed.netmask="$netmask"
 EOF
 
-echo "    IP address: $ipaddr"
-echo "    Netmask   : $interface_netmask"
+uci_commitverbose "Setup interface $netrenamed" network
 
 # setup dhcp alias/interface
@@ -39,14 +36,10 @@
 	vap=$(uci -q get meshwizard.netconfig.${net}_vap)
 
-	# Clean/rename config
+	# Rename config
 	handle_dhcpalias() {
 			config_get interface "$1" interface
 			if [ "$interface" == "$netrenamed" ]; then
-				if [ "$cleanup" == 1 ]; then
-					section_cleanup network.$1
-				else
-					if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
-						section_rename network $1 ${netrenamed}dhcp
-					fi
+				if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
+					section_rename network $1 ${netrenamed}dhcp
 				fi
 			fi
@@ -69,23 +62,16 @@
 
 	if [ "$vap" == 1 ]; then
-		echo "    + Setup interface ${netrenamed}dhcp."
 		uci set network.${netrenamed}dhcp=interface
 	else
-		echo "    + Setup alias interface ${netrenamed}dhcp."
 		uci set network.${netrenamed}dhcp=alias
 		uci set network.${netrenamed}dhcp.interface="$netrenamed"
 	fi
 
-	uci batch << EOF
-set network.${netrenamed}dhcp.proto=static
-set network.${netrenamed}dhcp.ipaddr="$START"
-set network.${netrenamed}dhcp.netmask="$NETMASK"
-EOF
-
-	echo "    interface: $net
-    ipaddr: $START
-    netmask: $NETMASK"
+	uci batch <<- EOF
+		set network.${netrenamed}dhcp.proto=static
+		set network.${netrenamed}dhcp.ipaddr="$START"
+		set network.${netrenamed}dhcp.netmask="$NETMASK"
+	EOF
+	uci_commitverbose  "Setup interface for ${netrenamed}dhcp" network
 
 fi
-
-uci commit
