davesteele / comitup

Bootstrap Wifi support over Wifi
https://davesteele.github.io/comitup/
GNU General Public License v2.0
322 stars 54 forks source link

Fails silently if SSID is unusual. #193

Closed cire831 closed 2 years ago

cire831 commented 2 years ago

running version 1.2.5

The RPi comes up fine, comitup is active and announcing hotspot comitup-7340. I connect to it and manually launch a browser to 10.42.0.1

I am presented with one selection for "Familytimevacationrentals.com\x20". Yes, I know someone configured a space on the end of the SSID name for the access point. I'll get them to fix this soon as I get the password to the AP.

I select that network and enter the password for the above network. Nothing happens. The RPi running comitup is still in HOTSOT mode, announcing comitup-7340.

I have a console on the RPi, so I then used comitup-cli to connect manually

dvt3 (5): comitup-cli

State: HOTSPOT
Connection: comitup-7340
Points:
    1: Familytimevacationrentals.com\x20
    2: TP-LINK_9827_almond
Available commands:
    (i)nfo
    (r)eload
    (q)uit
    connect to <n>
    (m)anual connection
command?: 1
password: 
Traceback (most recent call last):
  File "/usr/sbin/comitup-cli", line 11, in <module>
    load_entry_point('comitup==1.2.5', 'console_scripts', 'comitup-cli')()
  File "/usr/share/comitup/cli/comitupcli.py", line 112, in interpreter
    do_connect(ciu_client, points[index-1]['ssid'], password)
  File "/usr/share/comitup/cli/comitupcli.py", line 37, in do_connect
    ciu_client.ciu_connect(ssid, password)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.NetworkManager.Settings.Connection.InvalidProperty: 802-11-wireless.ssid: SSID length is out of range <1-32> bytes
dvt3 (6):
davesteele commented 2 years ago

I haven't replicated your specific failure, but I see the problem. The code conflates the ap_name and the mdns domain to be exported on connection. Normally that is not a problem, but your example fails that for a couple reasons.

davesteele commented 2 years ago

Your error message shows that the "\x20" is being taken literally. If that is really a space, that's an additional spin on the problem.

Are you sure it's a space? They are normally supported.

cire831 commented 2 years ago

On Thu, Oct 21, 2021 at 9:43 AM David Steele @.***> wrote:

Your error message shows that the "\x20" is being taken literally. If that is really a space, that's an additional spin on the problem.

Are you sure it's a space? They are normally supported.

in the ssid name itself it is indeed a space, but when the web interface presents it and uses it the representation "\x20" is interpreted literally making the length of the string > 32 bytes.

If I entered the ssid manually as "Familytimevacationrentals.com ", comitup connects to the wireless net correctly.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davesteele/comitup/issues/193#issuecomment-948734003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADDR2LJUT6YUJYF3PWOFQLUIAYI5ANCNFSM5GMGT2BQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Eric B. Decker Senior (over 50 :-) Researcher i love eating my family and not using commas (:-)

davesteele commented 2 years ago

In debugging, I found that a NetworkManager connection that should create a hotspot with a trailing space actually creates one with a bizarre escape sequence. That's a wontfix.

The escape you are seeing is from the "iw" command, which I use to get the AP list. I fixed this, but, well, it leads to the creation of a NetworkManager connection, which changes it back to the escape sequence in connection name and AP name, which will always fail.

This is a NetworkManager bug. wontfix.

cire831 commented 2 years ago

no problem.

i'm a long term developer as well. I wrote a ton of the early cisco code.

so i get it. I also understand, that the SSID was misconfigured, seems most nodes ignore the extra space or work around it in some fashion.

The question is is it worth doing a work around in the code for something that is a configuration error to begin with?

Probably not.

But fixing it would make the code more robust. But it's a weird corner case, I'm good either way.

On Thu, Oct 21, 2021 at 12:50 PM David Steele @.***> wrote:

In debugging, I found that a NetworkManager connection that should create a hotspot with a trailing space actually creates one with a bizarre escape sequence. That's a wontfix https://www.goodreads.com/quotes/7570350-the-patient-says-doctor-it-hurts-when-i-do-this .

The escape you are seeing is from the "iw" command, which I use to get the AP list. I fixed this, but, well, it leads to the creation of a NetworkManager connection, which changes it back to the escape sequence in connection name and AP name, which will always fail.

This is a NetworkManager bug. wontfix.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davesteele/comitup/issues/193#issuecomment-948907543, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADDR2PO6ETIEBPYIUZW2QTUIBOG3ANCNFSM5GMGT2BQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Eric B. Decker Senior (over 50 :-) Researcher i love eating my family and not using commas (:-)

cire831 commented 2 years ago

Your error message shows that the "\x20" is being taken literally. If that is really a space, that's an additional spin on the problem.

Are you sure it's a space? They are normally supported.

the problem is somewhere along the line, the space got translated into an escape sequence which is then literally used.

It isn't translated back into a space. Which then makes the SSID identifier > 32 bytes.

Do you know where the 32 byte limit came from? Is it from the Wifi spec? Probably. I don't care enough to go look it up.

davesteele commented 2 years ago

Yes, SSIDs are limited to 32 chars by spec.