[RFC 32/34] nl80211: Support updating NAN configuration

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

 



From: Ilan Peer <ilan.peer@xxxxxxxxx>

Add support for updating NAN cluster configuration.

Signed-off-by: Ilan Peer <ilan.peer@xxxxxxxxx>
---
 src/drivers/driver_nl80211.c | 69 +++++++++++++++++++++++++-----------
 1 file changed, 49 insertions(+), 20 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 09517629f7..f46c8f3b0a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -15049,23 +15049,14 @@ wpa_driver_get_multi_hw_info(void *priv, unsigned int *num_multi_hws)
 
 #ifdef CONFIG_NAN
 
-static int wpa_driver_nl80211_nan_start(void *priv,
-					struct nan_cluster_config *params)
+static int nl80211_nan_config(struct i802_bss *bss,
+			      struct wpa_driver_nl80211_data *drv,
+			      struct nan_cluster_config *params,
+			      enum nl80211_commands cmd)
 {
-	struct i802_bss *bss = priv;
-	struct wpa_driver_nl80211_data *drv = bss->drv;
 	struct nl_msg *msg;
 	struct nlattr *conf;
 	u32 bands = 0;
-	int ret;
-
-	if (drv->nlmode != NL80211_IFTYPE_NAN)
-		return -EOPNOTSUPP;
-
-	if (drv->nan_started)
-		return -EALREADY;
-
-	wpa_printf(MSG_DEBUG, "nl80211: Start/Join NAN cluster");
 
 	if (params->dual_band > 1)
 		return -EINVAL;
@@ -15078,16 +15069,16 @@ static int wpa_driver_nl80211_nan_start(void *priv,
 			bands |= BIT(NL80211_BAND_5GHZ);
 		} else {
 			wpa_printf(MSG_DEBUG,
-				   "nl80211: Driver doesn't support NAN dual band operation");
+				   "nl80211: NAN: No support for dual band");
 			return -EINVAL;
 		}
 	}
 
-	msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_START_NAN);
+	msg = nl80211_cmd_msg(bss, 0, cmd);
 	if (!msg || nla_put_u8(msg, NL80211_ATTR_NAN_MASTER_PREF,
 			       params->master_pref) ||
 	    (bands && nla_put_u32(msg, NL80211_ATTR_BANDS, bands))) {
-		wpa_printf(MSG_ERROR, "Failed to build start NAN command");
+		wpa_printf(MSG_ERROR, "nl80211: NAN: Failed to build command");
 		goto fail;
 	}
 
@@ -15110,16 +15101,53 @@ static int wpa_driver_nl80211_nan_start(void *priv,
 	/* TODO: Set more attributes */
 	nla_nest_end(msg, conf);
 
-	ret = send_and_recv_resp(drv, msg, NULL, NULL);
+	return send_and_recv_resp(drv, msg, NULL, NULL);
+fail:
+	nlmsg_free(msg);
+	return -1;
+}
+
+static int wpa_driver_nl80211_nan_start(void *priv,
+					struct nan_cluster_config *params)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	int ret;
+
+	if (drv->nlmode != NL80211_IFTYPE_NAN)
+		return -EOPNOTSUPP;
+
+	if (drv->nan_started)
+		return -EALREADY;
+
+	wpa_printf(MSG_DEBUG, "nl80211: Start/Join NAN cluster");
+	ret = nl80211_nan_config(bss, drv, params, NL80211_CMD_START_NAN);
 	if (!ret)
 		drv->nan_started = 1;
 
 	return ret;
-fail:
-	nlmsg_free(msg);
-	return -1;
 }
 
+
+static int
+wpa_driver_nl80211_nan_change_config(void *priv,
+				     struct nan_cluster_config *params)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+
+	if (drv->nlmode != NL80211_IFTYPE_NAN)
+		return -EOPNOTSUPP;
+
+	if (!drv->nan_started)
+		return -EINVAL;
+
+	wpa_printf(MSG_DEBUG, "nl80211: Update NAN configuration");
+	return nl80211_nan_config(bss, drv, params,
+				  NL80211_CMD_CHANGE_NAN_CONFIG);
+}
+
+
 static void wpa_driver_nl80211_nan_stop(void *priv)
 {
 	struct i802_bss *bss = priv;
@@ -15317,5 +15345,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 #ifdef CONFIG_NAN
 	.nan_start = wpa_driver_nl80211_nan_start,
 	.nan_stop = wpa_driver_nl80211_nan_stop,
+	.nan_change_config = wpa_driver_nl80211_nan_change_config,
 #endif /*CONFIG_NAN */
 };
-- 
2.49.0


_______________________________________________
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