[PATCH v8 11/16] mesh: consider mesh interface on dfs event handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Oh <peter.oh@xxxxxxxxxxxxxxxxx>

Once mesh starts supporting DFS channels, it has to handle DFS related events
from drivers, hence add mesh interface to the check list.

Signed-off-by: Peter Oh <peter.oh@xxxxxxxxxxxxxxxxx>
Signed-off-by: Masashi Honma <masashi.honma@xxxxxxxxx>
---
 wpa_supplicant/ap.c     | 71 ++++++++++++++++++++++++++++++++++++-------------
 wpa_supplicant/events.c |  7 ++---
 2 files changed, 57 insertions(+), 21 deletions(-)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index ea846a0..eebbe0a 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1379,13 +1379,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
 		       int offset, int width, int cf1, int cf2)
 {
-	if (!wpa_s->ap_iface)
-		return;
+	struct hostapd_iface *iface = wpa_s->ap_iface;
 
+	if (!wpa_s->ap_iface) {
+		if (!wpa_s->ifmsh)
+			return;
+		else
+			iface = wpa_s->ifmsh;
+	}
 	wpa_s->assoc_freq = freq;
 	if (wpa_s->current_ssid)
 		wpa_s->current_ssid->frequency = freq;
-	hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
+	hostapd_event_ch_switch(iface->bss[0], freq, ht,
 				offset, width, cf1, cf2);
 }
 
@@ -1582,10 +1587,16 @@ int wpas_ap_pmksa_cache_add_external(struct wpa_supplicant *wpa_s, char *cmd)
 void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
 				      struct dfs_event *radar)
 {
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
-		return;
+	struct hostapd_iface *iface = wpa_s->ap_iface;
+
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
+		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
+			return;
+		else
+			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
-	hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
+	hostapd_dfs_radar_detected(iface, radar->freq,
 				   radar->ht_enabled, radar->chan_offset,
 				   radar->chan_width,
 				   radar->cf1, radar->cf2);
@@ -1595,10 +1606,16 @@ void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 				   struct dfs_event *radar)
 {
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
-		return;
+	struct hostapd_iface *iface = wpa_s->ap_iface;
+
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
+		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
+			return;
+		else
+			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
-	hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
+	hostapd_dfs_start_cac(iface, radar->freq,
 			      radar->ht_enabled, radar->chan_offset,
 			      radar->chan_width, radar->cf1, radar->cf2);
 }
@@ -1607,10 +1624,16 @@ void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
 				    struct dfs_event *radar)
 {
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
-		return;
+	struct hostapd_iface *iface = wpa_s->ap_iface;
+
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
+		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
+			return;
+		else
+			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
-	hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
+	hostapd_dfs_complete_cac(iface, 1, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
 				 radar->chan_width, radar->cf1, radar->cf2);
 }
@@ -1619,10 +1642,16 @@ void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
 				   struct dfs_event *radar)
 {
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
-		return;
+	struct hostapd_iface *iface = wpa_s->ap_iface;
+
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
+		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
+			return;
+		else
+			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
-	hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
+	hostapd_dfs_complete_cac(iface, 0, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
 				 radar->chan_width, radar->cf1, radar->cf2);
 }
@@ -1631,10 +1660,16 @@ void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
 					struct dfs_event *radar)
 {
-	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
-		return;
+	struct hostapd_iface *iface = wpa_s->ap_iface;
+
+	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
+		if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
+			return;
+		else
+			iface = wpa_s->ifmsh;
+	}
 	wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
-	hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
+	hostapd_dfs_nop_finished(iface, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
 				 radar->chan_width, radar->cf1, radar->cf2);
 }
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 4cdca34..e43c1ac 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3808,7 +3808,7 @@ static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 				       struct dfs_event *radar)
 {
 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-	if (wpa_s->ap_iface) {
+	if (wpa_s->ap_iface || wpa_s->ifmsh) {
 		wpas_ap_event_dfs_cac_started(wpa_s, radar);
 	} else
 #endif /* NEED_AP_MLME && CONFIG_AP */
@@ -3829,7 +3829,7 @@ static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
 					struct dfs_event *radar)
 {
 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-	if (wpa_s->ap_iface) {
+	if (wpa_s->ap_iface || wpa_s->ifmsh) {
 		wpas_ap_event_dfs_cac_finished(wpa_s, radar);
 	} else
 #endif /* NEED_AP_MLME && CONFIG_AP */
@@ -3845,7 +3845,7 @@ static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
 				       struct dfs_event *radar)
 {
 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-	if (wpa_s->ap_iface) {
+	if (wpa_s->ap_iface || wpa_s->ifmsh) {
 		wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
 	} else
 #endif /* NEED_AP_MLME && CONFIG_AP */
@@ -4286,6 +4286,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 #ifdef CONFIG_AP
 		if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
 		    wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
+		    wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
 		    wpa_s->current_ssid->mode ==
 		    WPAS_MODE_P2P_GROUP_FORMATION) {
 			wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,
-- 
2.7.4


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux