]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Clean up nl80211_scan_common() to use nl80211_cmd_msg()
authorJouni Malinen <j@w1.fi>
Sat, 6 Dec 2014 14:47:12 +0000 (16:47 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 6 Dec 2014 15:18:51 +0000 (17:18 +0200)
This helper function had not used the nl80211_set_iface_id() helper, but
there is no reason why it couldn't re-use the same helper as other
places using nl80211_cmd_msg().

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

index 3e7aa51ce320411c94d799e5985ab8b94c47e8a3..960e2e6a0b7a12395c3aa5e39a2bb740c47843cb 100644 (file)
@@ -2348,27 +2348,18 @@ void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx)
 
 
 static struct nl_msg *
-nl80211_scan_common(struct wpa_driver_nl80211_data *drv, u8 cmd,
-                   struct wpa_driver_scan_params *params, u64 *wdev_id)
+nl80211_scan_common(struct i802_bss *bss, u8 cmd,
+                   struct wpa_driver_scan_params *params)
 {
+       struct wpa_driver_nl80211_data *drv = bss->drv;
        struct nl_msg *msg;
        size_t i;
        u32 scan_flags = 0;
-       int res;
 
-       msg = nlmsg_alloc();
+       msg = nl80211_cmd_msg(bss, 0, cmd);
        if (!msg)
                return NULL;
 
-       nl80211_cmd(drv, msg, 0, cmd);
-
-       if (!wdev_id)
-               res = nla_put_u32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
-       else
-               res = nla_put_u64(msg, NL80211_ATTR_WDEV, *wdev_id);
-       if (res < 0)
-               goto fail;
-
        if (params->num_ssids) {
                struct nlattr *ssids;
 
@@ -2452,8 +2443,7 @@ static int wpa_driver_nl80211_scan(struct i802_bss *bss,
        wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: scan request");
        drv->scan_for_auth = 0;
 
-       msg = nl80211_scan_common(drv, NL80211_CMD_TRIGGER_SCAN, params,
-                                 bss->wdev_id_set ? &bss->wdev_id : NULL);
+       msg = nl80211_scan_common(bss, NL80211_CMD_TRIGGER_SCAN, params);
        if (!msg)
                return -1;
 
@@ -2557,8 +2547,7 @@ static int wpa_driver_nl80211_sched_scan(void *priv,
                return android_pno_start(bss, params);
 #endif /* ANDROID */
 
-       msg = nl80211_scan_common(drv, NL80211_CMD_START_SCHED_SCAN, params,
-                                 bss->wdev_id_set ? &bss->wdev_id : NULL);
+       msg = nl80211_scan_common(bss, NL80211_CMD_START_SCHED_SCAN, params);
        if (!msg ||
            nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, interval))
                goto fail;