Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect, record if wifi can be AP and suppress installing supporting files #3070

Merged
merged 2 commits into from
May 19, 2022

Conversation

jvonau
Copy link
Contributor

@jvonau jvonau commented Dec 17, 2021

Fixes bug:

hostapd restart error noted in #3057 (comment)

Untested

@holta holta added this to the 7.2 milestone Dec 17, 2021
@holta
Copy link
Member

holta commented Dec 17, 2021

@jvonau are the 1+6 mentions of "AP" in bold below extraneous — not offering any hope at all to enable AP mode? (as an example, apparently from a Kingdel PC)

Paste below from file /etc/NetworkManager/system-connections/Wi-Fi connection 1.nmconnection :

[wifi]
band=bg
channel=9
mac-address=00:1E:65:41:55:61
mac-address-blacklist=
mode=ap
ssid=SmartBox

Output below from command /usr/sbin/iw list :

Supported interface modes:
* IBSS
* managed
* monitor
Band 1:

...

Supported commands:
* new_interface
* set_interface
* new_key
* start_ap
* new_station

...

Supported TX frame types:
* IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0

...

Supported RX frame types:
* IBSS: 0x40 0xb0 0xc0 0xd0
* managed: 0x40 0xd0
* AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0

...

Driver supports full state transitions for AP/GO clients

(Above excerpts are from iiab-diagnostics http://sprunge.us/NMOYJl?en)

@holta holta changed the title Detect, recored if wifi can be AP and suppress installing supporting files Detect, record if wifi can be AP and suppress installing supporting files Dec 17, 2021
@jvonau
Copy link
Contributor Author

jvonau commented Dec 17, 2021

Now what has been presented is a user configured WiFi network, given I shown you how to use NetworkManager's connection sharing on an XO-4 what in 2014-2015, running iiab-network would cause a clash over control of the wifi device causing the crash noted at Restart hostapd when WiFi is present in the pastebin. Easiest course of action would be to set "hostapd_enable False" in local_vars.yml as a start and look at #3014 for those experts that know how to configure a network properly and don't need hand holding.

@jvonau
Copy link
Contributor Author

jvonau commented Dec 17, 2021

1677 	software interface modes (can always be added):
1678 		 * monitor
1679 	interface combinations are not supported

#3057 (comment) won't support ap0, I'd would try with wifi_up_down: False.
sudo iiab-hotspot-off
edit local_vars
cd /opt/iiab/iiab
sudo ./iiab-network
sudo iib-hotspot-on
Or
Just use the GUI to manage the network but the trouble is admin-console will run the network role anyway, is_guest would need to be added to iiab-from-console.yml also.

1098 -IIAB--------------------------------------------------------------------------
1099 -rw------- 1 root root 343 Dec 11 10:39 /etc/NetworkManager/system-connections/Wi-Fi connection 1.nmconnection
1100                         ...ITS LAST 100 LINES FOLLOW...
1101 
1102 [connection]
1103 id=Wi-Fi connection 1
1104 uuid=aee7d61d-bfbf-4e4a-840d-5daab2601e6d
1105 type=wifi
1106 interface-name=wlp3s0
1107 permissions=
1108 
1109 [wifi]
1110 band=bg
1111 channel=9
1112 mac-address=00:1E:65:41:55:61
1113 mac-address-blacklist=
1114 mode=ap
1115 ssid=SmartBox
1116 
1117 [ipv4]
1118 dns-search=
1119 method=shared
1120 
1121 [ipv6]
1122 addr-gen-mode=stable-privacy
1123 dns-search=
1124 ip6-privacy=0
1125 method=shared

Did this connection actually become active and working? That would be useful information to know.

@jvonau
Copy link
Contributor Author

jvonau commented Dec 18, 2021

@jvonau are the 1+6 mentions of "AP" in bold below extraneous — not offering any hope at all to enable AP mode? (as an example, apparently from a Kingdel PC)

I would think none.

Driver supports full state transitions for AP/GO clients

(Above excerpts are from iiab-diagnostics http://sprunge.us/NMOYJl?en)

see https://wiki.gentoo.org/wiki/Hostapd & https://gist.github.com/Semant1ka/ee087c2bd1fbf6b0287c3307b8d4f291

@holta holta modified the milestones: 7.2, 8.0 Jan 1, 2022
@@ -101,6 +101,16 @@
set_fact:
num_wifi_interfaces: "{{ count_wifi_interfaces.stdout|int }}"

- name: Check for Access Point capablility with 'iw list'
command: iw list | grep -v AP: | grep AP | wc -l
Copy link
Member

@holta holta Apr 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes AP appears in comments like the following — e.g. on a Raspberry Pi 4 Model B Rev 1.1 in this case:

root@box:~# iw list | grep -vn AP: | grep AP
21:              * AP
164:             * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
188:            * [ 4WAY_HANDSHAKE_AP_PSK ]: AP mode PSK offload support

Should we... perhaps instead... grep for any string(s) * AP that appear at the end of any lines?

(If the existence of at least one of these... is indeed the decider/clincher?)

Suggested change
command: iw list | grep -v AP: | grep AP | wc -l
command: iw list | grep '* AP$' | wc -l

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 164 188 will not exist without line 21 and the test below is against an integer, what return value is provided without wc -l?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 164 188 will not exist without line 21

For sure, I agree.

I was just suggesting a failsafe — e.g. in case the string 'AP' mysteriously appears in comments arising from diverse/wonky WiFi cards in future?

Towards possibly making things even more resilient?

what return value is provided without wc -l?

I restored the wc -l into the suggestion above a few minutes ago.

bash can do the counting, if counting's required, that works too.

Whereas another option is to avoid bash and have Ansible do the counting — e.g. using code like REGISTER_VAR.stdout_lines | length > 0 here:

- name: "Look for any WiFi devices present: ls -la /sys/class/net/*/phy80211 | cut -d/ -f5"
shell: ls -la /sys/class/net/*/phy80211 | cut -d/ -f5
register: wifi_devices
ignore_errors: True
changed_when: False
- name: "Set has_wifi_device: True, if output (from above) shows device(s) here: {{ wifi_devices.stdout_lines }}"
set_fact:
has_wifi_device: True
when: wifi_devices is defined and wifi_devices.stdout_lines | length > 0
# when: wifi_devices is defined and wifi_devices.stdout | trim != ""

@holta
Copy link
Member

holta commented Apr 20, 2022

Every year, lots of people make clear they want/need this!
(Of course with a clean UX + clean documentation, that might come later if the stars align...)

What test cases / HW / OS should be prioritized to smoke-test this PR?

@jvonau jvonau mentioned this pull request May 9, 2022
@jvonau
Copy link
Contributor Author

jvonau commented May 9, 2022

Untested

missing quotes corrected in 3216
didn't like command corrected in 3216

@jvonau
Copy link
Contributor Author

jvonau commented May 9, 2022

Can this PR be considered prior to...?

* PR [Wifi net2 #3173](https://github.com/iiab/iiab/pull/3173)

* PR [set 'host_country_code' to value found in wpa_supplicant.conf [on Raspberry Pi OS only, deferring Ubuntu/Debian upstream issues] #3179](https://github.com/iiab/iiab/pull/3179) related to [Should host_country_code in local_vars.yml update wpa_supplicant.conf not just hostapd.conf ? #3097](https://github.com/iiab/iiab/issues/3097)

Shouldn't the PR number tell you the age?

@jvonau
Copy link
Contributor Author

jvonau commented May 9, 2022

Found this while running ./iiab-network

TASK [firmware : Symlink /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab -> brcmfmac43455-sdio.bin_2021-11-30_minimal (as rpi3bplus_rpi4_wifi_firmware is "19")] ***
[WARNING]: Cannot set fs attributes on a non-existent symlink target. follow should be set to False to avoid this.
ok: [127.0.0.1]

@holta
Copy link
Member

holta commented May 9, 2022

brcmfmac43455-sdio.bin_2021-11-30_minimal

Can you tell if there might have been some kind of a network glitch during firmware/tasks/download.yml — when it was trying to download http://d.iiab.io/packages/brcmfmac43455-sdio.bin_2021-11-30_minimal to /lib/firmware/brcm/ ?

(Did several of those 7 files possibly fail to download, if you can tell what happened?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants