]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DFS: Fix hostapd operation without hw_mode driver data
authorJouni Malinen <j@w1.fi>
Sun, 16 Nov 2014 23:14:35 +0000 (01:14 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 16 Nov 2014 23:14:35 +0000 (01:14 +0200)
If DFS implementation was built in, some configurations with drivers
that do not provide mode information could end up dereferencing a NULL
pointer. Fix this by skipping DFS operations in such cases since not
having information about modes and channels means that hostapd could not
perform DFS anyway (i.e., either this is not a wireless driver or the
driver takes care of DFS internally).

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/dfs.c

index 6fc891c7afd656cf1c8e2a76be5171cad80e5d5e..0db5ef6913d152930673a8102fdffcb837db17f0 100644 (file)
@@ -640,6 +640,16 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
        int res, n_chans, n_chans1, start_chan_idx, start_chan_idx1;
        int skip_radar = 0;
 
+       if (!iface->current_mode) {
+               /*
+                * This can happen with drivers that do not provide mode
+                * information and as such, cannot really use hostapd for DFS.
+                */
+               wpa_printf(MSG_DEBUG,
+                          "DFS: No current_mode information - assume no need to perform DFS operations by hostapd");
+               return 1;
+       }
+
        iface->cac_started = 0;
 
        do {