Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless <linux-wireless@vger.kernel.org>
Subject: [FYI] use NLA_BINARY in nl80211
Date: Thu, 29 Mar 2007 00:20:08 +0200	[thread overview]
Message-ID: <1175120409.8807.4.camel@johannes.berg> (raw)

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 },



                 reply	other threads:[~2007-03-29 11:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1175120409.8807.4.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox