On Tue, 25 Aug 2015 21:16:08 +0100, Edward Bartolo wrote:
> On 25/08/2015, Irrwahn <irrwahn@???> wrote:
>> On Tue, 25 Aug 2015 20:20:20 +0200 (CEST), Karl wrote:
>>> Irrwahn:
>>>> On Tue, 25 Aug 2015 19:24:17 +0200 (CEST), Karl wrote:
>>>>> Tilt!:
>>>>>> i wonder if we ever get to see such SSIDs from iwlist anyway -
>>>>>> how is it supposed to print SSIDs that contain the zerobyte ...
>>>>>
>>>>> iwlib.c line 989..995:
>>>>> /* Is it a non-ASCII character ??? */
>>>>> if(isescape || !isascii(*s) || iscntrl(*s))
>>>>> {
>>>>> /* Escape */
>>>>> sprintf(d, "\\x%02X", *s);
>>>>> d += 4;
>>>>> }
>>>>
>>>> Thank you. One problem, though:
>>>> Not a single version of the Wireless Tools for Linux sources I
>>>> happened to stumble upon doing a quick internet search contains
>>>> this snippet, or anything remotely like it. Care to share with us,
>>>> where this originates?
>>>
>>> $ apt-get source wireless-tools
>>> $ cd wireless-tools-30~pre9
>>> $ ls iw*.[ch]
>>> iwconfig.c iwevent.c iwgetid.c iwlib.c iwlib.h iwlib-private.h
>>> iwlist.c iwmulticall.c iwpriv.c iwspy.c
>>> $ grep download debian/copyright
>>> It was downloaded from:
>>> http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
>>> $
>>>
>>>
>>> http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
>>> under "Wireless Tools latest versions":
>>> ///
>>> The main features of the latest beta is support for non-ASCII ESSIDs
>>> (such as localised ESSID), support for displaying Scanning Capabilities,
>>> slightly bigger scan buffer, fixing minor bug iwconfig parser and minor
>>> enhancement to ifrename :
>>>
>>> Wireless Tools version 30-pre9 (beta)
>>> ///
>>>
>>>> Or give a little more context, particularly
>>>> how isescape is set?
>>>
>>> iwlib.c line 971..981:
>>> /* Escape the escape to avoid ambiguity.
>>> * We do a fast path test for performance reason. Compiler will
>>> * optimise all that ;-) */
>>> if(*s == '\\')
>>> {
>>> /* Check if we would confuse it with an escape sequence */
>>> if((e-s) > 4 && (s[1] == 'x')
>>> && (isxdigit(s[2])) && (isxdigit(s[3])))
>>> {
>>> isescape = 1;
>>> }
>>
>> Thanks a lot, Karl! I was stupid enough to not simply apt-get the sources.
>> I checked, it is exactly the function that is used when printing the scan
>> results.
>>
>> That makes escaping for file system path purposes quite easy, as everything
>> is already escaped, except the notorious '/'. however, that is already taken
>> care of in my modified version of Ed's netman.
>>
>> Now, what about the consumers? I found out that wpa_supplicant can digest
>> printf-style escaping, provided the quoted string is prefixed with 'P':
>>
>> # ssid: SSID (mandatory); network name in one of the optional formats:
>> # - an ASCII string with double quotation
>> # - a hex string (two characters per octet of SSID)
>> # - a printf-escaped ASCII string P"<escaped string>"
>>
>> I was not able to find information on how ifup passes on the information
>> from the wpa-ssid field. Assuming it is just handed down as is, the only
>> change in netman would be to prefix the SSID with 'P'.
>>
> Since, netman does not touch /etc/network/interfaces, the system
> should still be able to connect using a wired connection to ethX.
> Obviously, the interface has to be activated using ifup ethX.
> Therefore, to use a wired connection, the backend should use
> /etc/network/interfaces as an interfaces file are simply call "ifup
> ethX". I think, there is no need to recreate another interfaces file
> which is already there waiting to be used.
Uh, I wasn't talking about wired connections, but sounds
reasonable.
> The contents of interfaces files created by backend are as follows,
> but if necessary, we can create more than more template, although it
> doesn't look it will be necessary.
>
> Interfaces File Contents:
>
> auto lo
> iface lo inet loopback
>
> iface wlan0 inet dhcp
> wpa-ssid EB-TP-LNK67
> wpa-psk "************"
<snip>
And that's exactly crunchpoint: How is the wpa-ssid line
processed by ifup, and does it accept the P"xyz\x0Ablah"
syntax used by wpa-supplicant?
--
Irrwahn