Linux wireless drivers development
 help / color / mirror / Atom feed
* [FYI] use NLA_BINARY in nl80211
@ 2007-03-28 22:20 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2007-03-28 22:20 UTC (permalink / raw)
  To: linux-wireless

Unfortunately I hadn't noticed when starting nl80211 that NLA_STRING
validation removes a trailing \0. This means that we have a problem
right now with SSIDs for example in nl80211 when they end with \0, or,
more importantly maybe, with key data as well.

This patch changes this to use the new NLA_BINARY attribute type I
created but which isn't in wireless-dev yet, it is in davem's .22 branch
though.

---
 net/wireless/nl80211.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--- wireless-dev.orig/net/wireless/nl80211.c	2007-03-29 00:16:07.935831178 +0200
+++ wireless-dev/net/wireless/nl80211.c	2007-03-29 00:16:14.825831178 +0200
@@ -75,7 +75,7 @@ static struct nla_policy nl80211_policy[
 				      .len = BUS_ID_SIZE-1 },
 	[NL80211_ATTR_IFTYPE] = { .type = NLA_U32 },
 	[NL80211_ATTR_BSSID] = { .len = ETH_ALEN },
-	[NL80211_ATTR_SSID] = { .type = NLA_STRING,
+	[NL80211_ATTR_SSID] = { .type = NLA_BINARY,
 				.len = IEEE80211_MAX_SSID_LEN },
 	[NL80211_ATTR_CHANNEL] = { .type = NLA_U32 },
 	[NL80211_ATTR_PHYMODE] = { .type = NLA_U32 },
@@ -85,7 +85,7 @@ static struct nla_policy nl80211_policy[
 	[NL80211_ATTR_BEACON_PERIOD] = { .type = NLA_U32 },
 	[NL80211_ATTR_DTIM_PERIOD] = { .type = NLA_U32 },
 	[NL80211_ATTR_TIMESTAMP] = { .type = NLA_U64 },
-	[NL80211_ATTR_IE] = { .type = NLA_STRING, .len = NL80211_MAX_IE_LEN },
+	[NL80211_ATTR_IE] = { .type = NLA_BINARY, .len = NL80211_MAX_IE_LEN },
 	[NL80211_ATTR_AUTH_ALGORITHM] = { .type = NLA_U32 },
 	[NL80211_ATTR_TIMEOUT_TU] = { .type = NLA_U32 },
 	[NL80211_ATTR_REASON_CODE] = { .type = NLA_U32 },
@@ -95,9 +95,10 @@ static struct nla_policy nl80211_policy[
 	[NL80211_ATTR_TRANSMIT_POWER] = { .type = NLA_U32 },
 	[NL80211_ATTR_FRAG_THRESHOLD] = { .type = NLA_U32 },
 	[NL80211_ATTR_FLAG_SCAN_ACTIVE] = { .type = NLA_FLAG },
-	[NL80211_ATTR_BEACON_HEAD] = { .type = NLA_STRING },
-	[NL80211_ATTR_BEACON_TAIL] = { .type = NLA_STRING },
-	[NL80211_ATTR_KEY_DATA] = { .type = NLA_STRING, .len = WLAN_MAX_KEY_LEN },
+	[NL80211_ATTR_BEACON_HEAD] = { .type = NLA_BINARY },
+	[NL80211_ATTR_BEACON_TAIL] = { .type = NLA_BINARY },
+	[NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY,
+				    .len = WLAN_MAX_KEY_LEN },
 	[NL80211_ATTR_KEY_ID] = { .type = NLA_U32 },
 	[NL80211_ATTR_KEY_TYPE] = { .type = NLA_U32 },
 	[NL80211_ATTR_MAC] = { .len = ETH_ALEN },



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-29 11:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-28 22:20 [FYI] use NLA_BINARY in nl80211 Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox