essid_len in SIOCSIWESSID

Jean Tourrilhes jt at bougret.hpl.hp.com
Tue Aug 31 13:08:44 EDT 2004


On Mon, Aug 30, 2004 at 07:49:16PM -0700, Jouni Malinen wrote:
> On Mon, Aug 30, 2004 at 09:37:17AM -0700, Jean Tourrilhes wrote:
> 
> > 	For some reasons, Wireless Extensions standardised on :
> > 		SSID length + 1
> 
> OK, I'll try to remember this. However, this brings in couple of extra
> questions..
> 
> > 	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.
> 
> So, is ioctl() caller supposed to always give a buffer of SSID len + 1
> to the driver? Even when iwr.u.essid.length would end up being 33 (i.e.,
> larger than IW_ESSID_MAX_SIZE)?

	Correct. The ioctl definition in wireless.c specifies
IW_ESSID_MAX_SIZE + 1.

> What about SIOCGIWESSID? Is ioctl() caller supposed to always give a
> buffer of 33 bytes and set iwr.u.essid.length to 33 in order to be able
> to receive SSID of maximum length (32 characters, plus than one extra
> character for nul termination)?

	Yep. You can check iwlib.c for this.

> What is the driver supposed to do if
> iwr.u.essid.length == 32 and SSID len is 32? Should it return -E2BIG?

	With the new API, you don't have to worry about that. The
buffer will always be 33 bytes. The code in wireless.c itself deals
with the -E2BIG.

> Should it leave out nul termination and leave .length == 32? Is .length
> set to SSID len + 1 on SIOCGIWESSID in general?
> 
> 
> Somehow, I think I may have asked these questions before, but at least I
> don't remember the answer anymore.. ;-)

	Don't worry, I admit it's a bit confusing.

> Jouni Malinen                                            PGP id EFC895FA

	Jean



More information about the HostAP mailing list