[wpa_supplicant] essid with non-ascii characters

Jouni Malinen j at w1.fi
Tue Aug 7 09:40:57 EDT 2012

On Fri, Aug 03, 2012 at 11:53:07PM +0200, Jouke Witteveen wrote:
> On Fri, Aug 3, 2012 at 7:05 PM, Dan Williams <dcbw at redhat.com> wrote:
> > Which is why I proposed something like a read-only ssid_hex config item
> > that just copies back the SSID in hex form or something like that.  I'm
> > pretty sure that doing any sort of magic munging of the SSID in the
> > config simply will not happen.
> >
> > The ssid field already accepts hex SSIDs if you do something like:
> >
> > ssid=AABBCCDD1199
> >
> > ie, by not enclosing the SSID in quotes.  So the only piece you're
> > missing is being able to *retrieve* the SSID in hex, right?
> That is right. The simpler, the better (i.e. preferably directly
> through scan_results).

This should now be possible with the current hostap.git snapshot. I
changed wpa_ssid_txt() to use printf-like escaping of the data instead
of masking non-ASCII characters. The new format is not identical (or
compatible) with the previous formats used for the ssid parameter in the
configuration file, so a new format is needed for this if you want to
just copy an SSID as-is without converting it into a hexdump.

For example:

$ wpa_cli scan_results
Selected interface 'wlan0'
bssid / frequency / signal level / flags / ssid
02:00:00:00:01:00	2412	-30	[ESS]	test\x00abc
$ wpa_cli bss 02:00:00:00:01:00 | grep ^ssid= | cut -d= -f2-
$ wpa_cli add_network
Selected interface 'wlan0'
$ wpa_cli set_network 0 key_mgmt NONE
Selected interface 'wlan0'
wpa_cli set_network 0 ssid 'P"test\x00abc"'
Selected interface 'wlan0'
$ wpa_cli select_network 0
Selected interface 'wlan0'

Or in the configuration file:


Jouni Malinen                                            PGP id EFC895FA

More information about the HostAP mailing list