essid_len in SIOCSIWESSID

Pedro Ramalhais ramalhais at serrado.net
Mon Aug 30 14:10:45 EDT 2004


On Mon, 2004-08-30 at 17:37, Jean Tourrilhes wrote:
> 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.
> 
> 	Have fun...
> 
> 	Jean

Jouni, since you said hostap copes with both ways of setting the
essid_length, would you change the code in driver_wext_set/get_essid()
to use length+1 instead? I don't see how we could change wireless
extensions, like Jean suggested, to support just setting length and not
breaking backwards compatibility.
-- 
Pedro Ramalhais <ramalhais at serrado.net>




More information about the HostAP mailing list