Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Conversation

mariomaz
Copy link
Collaborator

@mariomaz mariomaz commented Jul 27, 2020

PPM-311

Method beerocks::utils::get_iface_string_from_iface_vap_ids computes VAP name from interface name and VAP id using a hardcoded formula that produces names like "wlan0.0", "wlan0.1" and so on. While this is working fine for devices like RAX40, it does not work with Gl.Inet B1300, where there's only one VAP and it has the same name as the interface, so the computed VAP name does not exist.

To fix the problem, BSS (or name) of the VAP is now read from the device instead of computing it.

@mariomaz mariomaz force-pushed the bugfix/PPM-311_update_vap_stats_fails_in_glinet branch 3 times, most recently from 3b4bcf9 to 4e9ac7f Compare July 27, 2020 15:53
@mariomaz mariomaz changed the title bwl: add bss field to VAP element struct update_vap_stats() fails for wlan0.0 in Gl.Inet B1300 Jul 27, 2020
@mariomaz mariomaz marked this pull request as ready for review July 27, 2020 16:02
@mariomaz mariomaz added the don't merge This PR is not ready for merge or review label Jul 27, 2020
@mariomaz mariomaz force-pushed the bugfix/PPM-311_update_vap_stats_fails_in_glinet branch from 722db9a to e59e3f8 Compare July 28, 2020 08:12
mariomaz added 5 commits July 28, 2020 14:10
https://jira.prplfoundation.org/browse/PPM-311

Add a new field to VAPElement structure to hold the BSS (name) of the
VAP.

This field will later be used "as is", instead of the hardcoded value
that is currently being computed from the VAP ID with method
`beerocks::utils::get_iface_string_from_iface_vap_ids`

Signed-off-by: Mario Maz <mmazzapater@gmail.com>
https://jira.prplfoundation.org/browse/PPM-311

Fill in the BSS field of the VAPElement structure while refreshing VAP
info.

Signed-off-by: Mario Maz <mmazzapater@gmail.com>
https://jira.prplfoundation.org/browse/PPM-311

Fill in the BSS field of the VAPElement structure while refreshing VAP
info.

Signed-off-by: Mario Maz <mmazzapater@gmail.com>
https://jira.prplfoundation.org/browse/PPM-311

Do not use `beerocks::utils::get_iface_string_from_iface_vap_ids()` to
compute the VAP name from the VAP id. Instead of the hardcoded value,
use the BSS field of the VAPElement structure which was read from
device.

Signed-off-by: Mario Maz <mmazzapater@gmail.com>
https://jira.prplfoundation.org/browse/PPM-311

Do not use `beerocks::utils::get_iface_string_from_iface_vap_ids()` to
compute the VAP name from the VAP id. Instead of the hardcoded value,
use the BSS field of the VAPElement structure which was read from
device.

Signed-off-by: Mario Maz <mmazzapater@gmail.com>
@mariomaz mariomaz force-pushed the bugfix/PPM-311_update_vap_stats_fails_in_glinet branch from c7c6408 to a1fbd87 Compare July 28, 2020 12:19
@mariomaz mariomaz removed the don't merge This PR is not ready for merge or review label Jul 28, 2020
/**
* Basic Service Set (i.e.: VAP name, e.g.: wlan0.0, wlan0.1, wlan0.2, ...).
*/
std::string bss;
Copy link
Collaborator

Choose a reason for hiding this comment

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

bss is used in few meanings and formats along the code:

  • Sometimes it is a string representing mac address.
  • Sometimes it is a sMacAddr representing mac address.
  • and here it is the name of the vap.

I think it would be easier for developers, newcomers, maintainers, etc. to have clear names along the code.
I suggest to replace to vap_name (or just vap) as you explained in the comment above this variable

(i.e.: VAP name, e.g.: wlan0.0, wlan0.1, wlan0.2, ...)

Suggested change
std::string bss;
std::string vap_name;

Copy link
Collaborator Author

@mariomaz mariomaz Aug 11, 2020

Choose a reason for hiding this comment

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

I agree with you that there's room for improvement regarding names and types in this project.
But in this case, I think the field that contains a MAC address (sometimes as a string and others as a sMacAddr) is the BSSID, not the BSS.

The reason to chose bss over any other name is simple: the information contained in the VAPElement struct is obtained using the hostapd command "STATUS", whose output in a RAX40 is like:

...
bss[0]=wlan0
bssid[0]=02:9a:96:fb:59:0f
ssid[0]=dummy_ssid_0
num_sta[0]=0
bss[1]=wlan0.0
bssid[1]=02:9a:96:fb:59:11
ssid[1]=prplMesh
num_sta[1]=0
bss[2]=wlan0.1
bssid[2]=02:9a:96:fb:59:12
ssid[2]=wave_11
num_sta[2]=0
bss[3]=wlan0.2
bssid[3]=02:9a:96:fb:59:13
ssid[3]=wave_12
num_sta[3]=0
bss[4]=wlan0.3
bssid[4]=02:9a:96:fb:59:14
ssid[4]=wave_13
num_sta[4]=0

Fields bssid and ssid where already present in the VAPElement struct and then I just added the new bss field.

What we might do is to rename mac to bssid in VAPElement, but that's not part of this PR.

@RanRegev RanRegev self-requested a review August 5, 2020 13:25
// New VAP Element
VAPElement vapElement;

vapElement.bss = ifname;
Copy link
Collaborator

Choose a reason for hiding this comment

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

naming (see previous comment regarding this issue)
this is so misleading:
bss == ifname == mac (sometimes) == vap

if (radio_vaps.find(vap_id) != radio_vaps.end()) {
auto iface_name = beerocks::utils::get_iface_string_from_iface_vap_ids(
mon_wlan_hal->get_radio_info().iface_name, vap_id);
auto iface_name = radio_vaps.at(vap_id).bss;
Copy link
Collaborator

Choose a reason for hiding this comment

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

again, the naming issue... I think the idea is clear at this point, too many names for the same thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As said, I agree with you. But if I rename this variable, then I'll also have to rename the parameter of the method where it's used. And then the monitor_vap_node class. And then ... And that's out of the scope of this PR.

Copy link
Collaborator

@rmelotte rmelotte left a comment

Choose a reason for hiding this comment

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

At the moment get_iface_string_from_iface_vap_ids is still needed in some places for the dwpal BWL, so let's merge this one and remove what remains in another PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants