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

Commit

Permalink
agent: add local interface field for wired interface
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Maz <[email protected]>
  • Loading branch information
mariomaz committed Feb 7, 2020
1 parent 9bdefaf commit eb992df
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#include <bpl/bpl_cfg.h>
#include <bpl/bpl_err.h>

// SPEED values
#include <linux/ethtool.h>

using namespace beerocks::net;

namespace beerocks {
Expand Down Expand Up @@ -1784,6 +1787,30 @@ bool backhaul_manager::handle_1905_topology_query(ieee1905_1::CmduMessageRx &cmd

tlvDeviceInformation->mac() = network_utils::mac_from_string(bridge_info.mac);

uint32_t speed;
if (network_utils::linux_iface_get_speed(bridge_info.iface, speed)) {
std::shared_ptr<ieee1905_1::cLocalInterfaceInfo> localInterfaceInfo =
tlvDeviceInformation->create_local_interface_list();

ieee1905_1::eMediaType media_type = ieee1905_1::eMediaType::UNKNONWN_MEDIA;
if (SPEED_100 == speed) {
media_type = ieee1905_1::eMediaType::IEEE_802_3U_FAST_ETHERNET;
} else if (SPEED_1000 == speed) {
media_type = ieee1905_1::eMediaType::IEEE_802_3AB_GIGABIT_ETHERNET;
}

localInterfaceInfo->mac() = network_utils::mac_from_string(bridge_info.mac);
localInterfaceInfo->media_type() = media_type;
localInterfaceInfo->media_info_length() = 0;

tlvDeviceInformation->add_local_interface_list(localInterfaceInfo);
}

// TODO: Add a LocalInterfaceInfo field for each wireless interface.
// This is something that cannot be done at this moment because the MediaType field
// must be computed with information obtained through NL80211_CMD_GET_WIPHY command of DWPAL,
// which is currently not supported. See "Send standard NL80211 commands using DWPAL #782"

auto tlvSupportedService = cmdu_tx.addClass<wfa_map::tlvSupportedService>();
if (!tlvSupportedService) {
LOG(ERROR) << "addClass wfa_map::tlvSupportedService failed, mid=" << std::hex << (int)mid;
Expand Down

0 comments on commit eb992df

Please sign in to comment.