Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions agent/src/beerocks/slave/agent_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,17 @@ bool AgentDB::get_mac_by_ssid(const sMacAddr &ruid, const std::string &ssid, sMa
return false;
}

bool AgentDB::get_bsta_mac_by_ruid(const sMacAddr &ruid, sMacAddr &value)
{
value = net::network_utils::ZERO_MAC;
auto radio = get_radio_by_mac(ruid, AgentDB::eMacType::RADIO);
if (!radio) {
LOG(ERROR) << "No radio with ruid '" << ruid << "' found!";
return false;
}

value = radio->back.iface_mac;
return true;
}

} // namespace beerocks
9 changes: 9 additions & 0 deletions agent/src/beerocks/slave/agent_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ class AgentDB {
*/
bool get_mac_by_ssid(const sMacAddr &ruid, const std::string &ssid, sMacAddr &value);

/**
* @brief Get the MAC address of the backhaul sta based on the ruid.
*
* @param[in] ruid The Radio UID.
* @param[out] value The mac address of the backaul sta if found, else an invalid MAC (zero).
* @return true if the MAC address was found, false otherwise.
*/
bool get_bsta_mac_by_ruid(const sMacAddr &ruid, sMacAddr &value);

/**
* @brief 1905.1 Neighbor device information
* Information gathered from a neighbor device upon reception of a Topology Discovery message.
Expand Down
10 changes: 7 additions & 3 deletions agent/src/beerocks/slave/agent_ucc_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ bool agent_ucc_listener::handle_dev_get_param(std::unordered_map<std::string, st
auto ruid_str = tlvf::mac_to_string(std::strtoull(params["ruid"].c_str(), nullptr, 16));
auto ruid = tlvf::mac_from_string(ruid_str);
if (params.find("ssid") == params.end()) {
// No ssid was given, return the radio MAC.
// We use MAC address as Radio UID, so we can just return it here.
value = ruid_str;
// No ssid was given, we need to return the backhaul sta mac.
if (!db->get_bsta_mac_by_ruid(ruid, mac_value)) {
LOG(ERROR) << " failed to find the backhaul sta MAC address for ruid '" << ruid_str;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
LOG(ERROR) << " failed to find the backhaul sta MAC address for ruid '" << ruid_str;
LOG(ERROR) << "Failed to find the backhaul sta MAC address for ruid " << ruid_str;

value = "backhaul sta MAC not found for ruid '" + ruid_str + "'";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe not for this PR, but using output parameter for both the requested MAC address on success and for an error message on failure is a bad practice.

return false;
}
value = tlvf::mac_to_string(mac_value);
return true;
}
auto ssid = params["ssid"];
Expand Down
2 changes: 1 addition & 1 deletion ci/easymesh_cert_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
399a33ca960cece195c3605d08951b8766e6c90d
62af397ceba0f0c4d2e3ca19c66ca0a5d4ed1330