diff mbox

[v2,1/2] nl80211: Replace interface socket owner attribute with more generic one

Message ID 1415792197-23080-2-git-send-email-jukka.rissanen@linux.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jukka Rissanen Nov. 12, 2014, 11:36 a.m. UTC
Replace NL80211_ATTR_IFACE_SOCKET_OWNER attribute with more generic
NL80211_ATTR_SOCKET_OWNER that can be used with other commands
that interface creation.
---
 include/uapi/linux/nl80211.h | 8 +++++---
 net/wireless/nl80211.c       | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

Comments

Luca Coelho Nov. 12, 2014, 11:47 a.m. UTC | #1
On Wed, 2014-11-12 at 13:36 +0200, Jukka Rissanen wrote:
> @@ -2056,6 +2056,8 @@ enum nl80211_attrs {
>  #define NL80211_ATTR_KEY NL80211_ATTR_KEY
>  #define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
>  #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
> +#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
> +#define NL80211_ATTR_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER

The second define seems to be a mistake?

--
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Nov. 12, 2014, 11:52 a.m. UTC | #2
On Wed, 2014-11-12 at 13:47 +0200, Luca Coelho wrote:
> On Wed, 2014-11-12 at 13:36 +0200, Jukka Rissanen wrote:
> > @@ -2056,6 +2056,8 @@ enum nl80211_attrs {
> >  #define NL80211_ATTR_KEY NL80211_ATTR_KEY
> >  #define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
> >  #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
> > +#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
> > +#define NL80211_ATTR_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
> 
> The second define seems to be a mistake?

Yes, both are wrong here. We played with defining some attributes to
themselves to allow #ifdef feature detection, but that didn't really
work out well and now we just copy nl80211.h to the userspace tools
needing a recent version. I think that's no longer needed now.

There should already be a second block of #ifdefs though that has
renamed ones, so you should add this one there.

Your patch is also missing signed-off-by.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 442369f..c410284 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1637,9 +1637,9 @@  enum nl80211_commands {
  * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
  *	As specified in the &enum nl80211_tdls_peer_capability.
  *
- * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface
+ * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
  *	creation then the new interface will be owned by the netlink socket
- *	that created it and will be destroyed when the socket is closed
+ *	that created it and will be destroyed when the socket is closed.
  *
  * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
  *	the TDLS link initiator.
@@ -2004,7 +2004,7 @@  enum nl80211_attrs {
 
 	NL80211_ATTR_TDLS_PEER_CAPABILITY,
 
-	NL80211_ATTR_IFACE_SOCKET_OWNER,
+	NL80211_ATTR_SOCKET_OWNER,
 
 	NL80211_ATTR_CSA_C_OFFSETS_TX,
 	NL80211_ATTR_MAX_CSA_COUNTERS,
@@ -2056,6 +2056,8 @@  enum nl80211_attrs {
 #define NL80211_ATTR_KEY NL80211_ATTR_KEY
 #define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
 #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
+#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
+#define NL80211_ATTR_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
 
 #define NL80211_MAX_SUPP_RATES			32
 #define NL80211_MAX_SUPP_HT_RATES		77
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d0a8361..df447c0 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -388,7 +388,7 @@  static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 	[NL80211_ATTR_MAC_HINT] = { .len = ETH_ALEN },
 	[NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 },
 	[NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 },
-	[NL80211_ATTR_IFACE_SOCKET_OWNER] = { .type = NLA_FLAG },
+	[NL80211_ATTR_SOCKET_OWNER] = { .type = NLA_FLAG },
 	[NL80211_ATTR_CSA_C_OFFSETS_TX] = { .type = NLA_BINARY },
 	[NL80211_ATTR_USE_RRM] = { .type = NLA_FLAG },
 	[NL80211_ATTR_TSID] = { .type = NLA_U8 },
@@ -2646,7 +2646,7 @@  static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
 		return PTR_ERR(wdev);
 	}
 
-	if (info->attrs[NL80211_ATTR_IFACE_SOCKET_OWNER])
+	if (info->attrs[NL80211_ATTR_SOCKET_OWNER])
 		wdev->owner_nlportid = info->snd_portid;
 
 	switch (type) {