فهرست منبع

allow mac80211 devices to be configured to do 802.11s, requires iw

SVN-Revision: 14669
Florian Fainelli 16 سال پیش
والد
کامیت
38821210b0
2فایلهای تغییر یافته به همراه25 افزوده شده و 3 حذف شده
  1. 9 1
      docs/wireless.tex
  2. 16 2
      package/mac80211/files/lib/wifi/mac80211.sh

+ 9 - 1
docs/wireless.tex

@@ -107,7 +107,7 @@ config wifi-device    wifi device name
 config wifi-iface
 config wifi-iface
     option network  the interface you want wifi to bridge with
     option network  the interface you want wifi to bridge with
     option device   wifi0, wifi1, wifi2, wifiN
     option device   wifi0, wifi1, wifi2, wifiN
-    option mode     ap, sta, adhoc, monitor, or wds
+    option mode     ap, sta, adhoc, monitor, mesh, or wds
     option txpower  (deprecated) transmission power in dBm
     option txpower  (deprecated) transmission power in dBm
     option ssid     ssid name
     option ssid     ssid name
     option bssid    bssid address
     option bssid    bssid address
@@ -184,6 +184,9 @@ config wifi-iface
             \item \texttt{monitor} \\
             \item \texttt{monitor} \\
                 Monitor mode
                 Monitor mode
 
 
+	    \item \texttt{mesh} \\
+		Mesh Point mode (802.11s)
+
             \item \texttt{wds} \\
             \item \texttt{wds} \\
                 WDS point-to-point link
                 WDS point-to-point link
 
 
@@ -229,6 +232,11 @@ config wifi-iface
 
 
 \end{itemize}
 \end{itemize}
 
 
+\paragraph{Mesh Point}
+
+Mesh Point (802.11s) is only supported by some mac80211 drivers. It requires the iw package
+to be installed to setup mesh links. OpenWrt creates mshN mesh point interfaces.
+
 \paragraph{Wireless Distribution System}
 \paragraph{Wireless Distribution System}
 
 
 WDS is a non-standard mode which will be working between two Broadcom devices for instance
 WDS is a non-standard mode which will be working between two Broadcom devices for instance

+ 16 - 2
package/mac80211/files/lib/wifi/mac80211.sh

@@ -13,14 +13,14 @@ scan_mac80211() {
 
 
 		config_get mode "$vif" mode
 		config_get mode "$vif" mode
 		case "$mode" in
 		case "$mode" in
-			adhoc|sta|ap|monitor)
+			adhoc|sta|ap|monitor|mesh)
 				append $mode "$vif"
 				append $mode "$vif"
 			;;
 			;;
 			*) echo "$device($vif): Invalid mode, ignored."; continue;;
 			*) echo "$device($vif): Invalid mode, ignored."; continue;;
 		esac
 		esac
 	done
 	done
 
 
-	config_set "$device" vifs "${ap:+$ap }${adhoc:+$adhoc }${ahdemo:+$ahdemo }${sta:+$sta }${wds:+$wds }${monitor:+$monitor}"
+	config_set "$device" vifs "${ap:+$ap }${adhoc:+$adhoc }${ahdemo:+$ahdemo }${sta:+$sta }${wds:+$wds }${monitor:+$monitor }${mesh:+$mesh}"
 }
 }
 
 
 
 
@@ -53,6 +53,7 @@ enable_mac80211() {
 	config_get txpower "$device" txpower
 	config_get txpower "$device" txpower
 
 
 	local first=1
 	local first=1
+	local mesh_idx=0
 	for vif in $vifs; do
 	for vif in $vifs; do
 		ifconfig "$ifname" down 2>/dev/null
 		ifconfig "$ifname" down 2>/dev/null
 		config_get ifname "$vif" ifname
 		config_get ifname "$vif" ifname
@@ -75,6 +76,13 @@ enable_mac80211() {
 				sleep 1
 				sleep 1
 				iwconfig "$ifname" mode ad-hoc >/dev/null 2>/dev/null
 				iwconfig "$ifname" mode ad-hoc >/dev/null 2>/dev/null
 			fi
 			fi
+			# mesh interface should be created only for the first interface
+			if [ "$mode" = mesh ]; then
+				config_get mesh_id "$vif" mesh_id
+				if [ -n "$mesh_id" ]; then
+					iw dev "$ifname" interface add msh$mesh_idx type mp mesh_id $mesh_id
+				fi
+			fi
 			sleep 1
 			sleep 1
 			iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
 			iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
 		}
 		}
@@ -162,8 +170,14 @@ enable_mac80211() {
 					}
 					}
 				fi
 				fi
 			;;
 			;;
+			mesh)
+				# special case where physical interface should be down for mesh to work
+				ifconfig "$ifname" down
+				ifconfig "msh$mesh_idx" up
+			;;
 		esac
 		esac
 		first=0
 		first=0
+		mesh_idx=$(expr $mesh_idx + 1)
 	done
 	done
 }
 }