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

Enable switching of AP interface #582

Merged
merged 33 commits into from
Jun 16, 2020
Merged

Enable switching of AP interface #582

merged 33 commits into from
Jun 16, 2020

Conversation

billz
Copy link
Member

@billz billz commented May 12, 2020

Created from @zbchristian's patch #580

@billz billz mentioned this pull request Jun 7, 2020
4 tasks
@billz
Copy link
Member Author

billz commented Jun 7, 2020

These commits write the user selected AP interface from the Hotspot UI to /etc/raspap/hostapd.ini and persist it in the session object.

Occurrences of RASPI_WIFI_CLIENT_INTERFACE are replaced throughout the project with the user-defined value. This constant is retained in config.php as a default setting.

Tested with an Edimax adapter on wlan1.

@billz billz linked an issue Jun 8, 2020 that may be closed by this pull request
@billz billz linked an issue Jun 9, 2020 that may be closed by this pull request
@billz
Copy link
Member Author

billz commented Jun 9, 2020

Code clarity improvement ideas:

  1. Unambiguous variable naming. client_iface is used for the session var (mea culpa). A better alternative might be ap_interface to distinguish it from the managed mode interface in a simultaneous wlan0/wlan1 config.
  2. As above for RASPI_WIFI_CLIENT_INTERFACE.
  3. Documentation for getWifiInterface().

@zbchristian
Copy link
Collaborator

Yes, the naming is a bit of a problem. Probably we need the ap_interface as well as the wifi_client_interface (managed interface) and other client interfaces like eth0, ppp0, usb0 etc.

@zbchristian
Copy link
Collaborator

@billz These changes broke my setup again. The problem is, that in some places the wifi_client_interface is needed and in others the ap_interface. In a setup with 2 wifi interfaces, these are different. I propose two session variables $_SESSION["ap_interface"] and $_SESSION["wifi_client_interface"]. Both are set in getWifiInterface() and will be the same in case of a single existing wifi interface and differ for 2 devices.
Will have a look at your changes and provide a PR.

@zbchristian
Copy link
Collaborator

@billz I think we need to clarify, where the wifi client is required (configure_client.php, status on dashboard, scanning neighbouring networks) and where the AP interface is needed. Your assigment does not work for me. I went through and modified to my understanding. For this I added $_SESSION["wifi_client_interface"]. It works now with 2 wifi interfaces. Had to modify getWifiInterface() in order for it to work with the initial setup after installation.
I have a PR ready. Have a look and tell me what you think.

@billz
Copy link
Member Author

billz commented Jun 9, 2020

@zbchristian I realized this in testing and began making similar mods ;) should have been obvious given that we're dealing with two adapters /facepalm

@billz
Copy link
Member Author

billz commented Jun 10, 2020

Made some changes to the dashboard to correctly use the AP rather than client interface for statistics.

@wyatt
Copy link

wyatt commented Jun 12, 2020

Is this almost ready to be merged - is there an ETA? Can't wait for this!
:)

@billz
Copy link
Member Author

billz commented Jun 12, 2020

@profwyattb the best way to speed things along is to participate in testing

@billz billz linked an issue Jun 13, 2020 that may be closed by this pull request
@billz
Copy link
Member Author

billz commented Jun 15, 2020

@zbchristian at this stage, we can think about adding some basic documentation for this feature to the wiki. I believe your #580 (comment) provides a good starting point

@zbchristian
Copy link
Collaborator

@billz Tried the latest version once more from scratch and it works fine.
I encountered one minor problem, which is not code related: had to save the hotspot settings (no changes) once and restart the hotspot to get the wifi client to work properly. Seems that the config files created during the inital installation are not covering this case completely . Might be just a DNS problem.

Ok, I can provide input for the Wiki.

@billz
Copy link
Member Author

billz commented Jun 16, 2020

@zbchristian just about to post that I was ready to test another clean install. you beat me to it ;)

Re: saving hotspot settings, this is likely related to the default config. Probably the static routers=10.3.141.1 setting in /etc/dhcpcd.conf which is the default for a wired eth0/wlan0 config.

@billz billz merged commit d95113e into master Jun 16, 2020
@billz billz deleted the zbchristian-wlan-switch branch June 26, 2020 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants