Improve namespaces to handle non-present SSIDs and improve monitor mode handling #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Bug fix + enhancement
Breaking change
Proposed change
Namespaces was requiring the configuration of a WLAN connection to succeed in the moment for the configuration to be considered to have been correctly applied. DHCP was run early in the process too, before knowing if the interface was connected and this would hang for 15s. Upon failure it would then attempt to roll the configuration back. This was compounded by the fact that all this took longer than the nginx timeout so a 500 error was received.
This change re-orders the sequence of events and polls wpa_cli every second for 15 seconds after a wpa_supplicant config has been applied. DHCP is then only started for interfaces in the connected state.
The previous two configuration outcomes were connected or error. Now this can be connected, provisioned or error.
Provisioned states return with success and wuickly bypass any attempts at DHCP
Cleanup code has been improved to ensure hanging wpa_supplicant daemon are removed and there is a clear revert function to get back to a default state with all adapters and interfaces in root namespace.
A fix for parsing of the interface MAC has also been applied.
While adapting the code, the insertion of the early bringup on mon mode has been added to comply with updated Intel guidance for LAR.
Testing
Tests were performed manually using postman and the WLAN Pi App. Tests creates which previously fail using a non present SSID now pass. The device can connect to that SSID later.
LLM/AI usage
Cursor was used to provide assistance coding the the changes needed to fix the main bug where non-present SSIDs were causing an error. Cursor created the initial changes to network_namespace_service.py and network_config.py and adapt the 2 state return (connected, error) to a 3 state return (connected, provisioned, error). The code was adapted by hand thereafter to ensure fully working state.
Checklist
Related Issues/PRs