essid_len in SIOCSIWESSID
jt at bougret.hpl.hp.com
Mon Aug 30 12:37:17 EDT 2004
On Sun, Aug 29, 2004 at 11:53:35AM -0700, Jouni Malinen wrote:
> On Sun, Aug 29, 2004 at 04:44:48PM +0100, Pedro Ramalhais wrote:
> > I've noticed that wpa_suplpicant is causing the essid to be set
> > incorrectly. wpa_supplicant is setting
> > iwr.u.essid.length = ssid_len
> > but wireless tools is setting
> > wrq.u.essid.length = strlen(essid) + 1
> > in SIOCSIWESSID.
> > So, which one is correct?
> SSID is allowed to contain ASCII-0 ("nul termination" in C strings) and
> strlen() would not give correct length for such a string. I believe SSID
> should be treated as a binary data, not a string. Consequently,
> strlen()+1 or real SSID length + 1 do not sound correct.
> However, this may be a bit problematic in real world with the current
> implementations of wireless extensions.. Host AP driver supports both
> strlen()+1 and SSID as binary data with correct length; though, it does
> not support ASCII-0.. If I remember correctly, there were some issues in
> setting 32-byte longth SSIDs with some versions of iwconfig. This was
> somehow related to this len or len+1 question.
> Jouni Malinen PGP id EFC895FA
For some reasons, Wireless Extensions standardised on :
SSID length + 1
That was a long while ago, it may be stupid, but that's what
was agreed and going back would be a lot of work. (Actually, there was
a good reason, but who cares).
Moreover, most of the tools and the driver also assume it's a
C string and will stop at the first ASCII-0. It might be possible to
fix this without having to rework the API, but nobody was bothered
enough to send me patches.
More information about the HostAP