 +				encryption="none"
 +			fi
 +			export channel
-+			iw dev "$ifname" set channel "$channel"
 +			config_set "$device" channel "$channel"
 +			uci_set wireless "$device" channel "$channel"
 +			config_set "$vif" mode "$mode"

 mac80211_hostapd_setup_base() {
 	local phy="$1"
 	local ifname="$2"
@@ -353,10 +355,53 @@
 		[ -n "$ifname" ] || {
 			[ $i -gt 0 ] && ifname="wlan${phy#phy}-$i" || ifname="wlan${phy#phy}"
 		}

 
 		# It is far easier to delete and create the desired interface
 		case "$mode" in
@@ -407,7 +451,7 @@
 		#
 		# ALL station functionality will be passed to wpa_supplicant
 		#
-		if [ ! "$mode" = "ap" ]; then
+		if [ "$mode" != "ap" -a "$mode" != "adhoc" ]; then
 			# We attempt to set the channel for all interfaces, although
 			# mac80211 may not support it or the driver might not yet
 			# for ap mode this is handled by hostapd
@@ -460,12 +504,37 @@
 
 		case "$mode" in
 			adhoc)
