diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2018-03-29 18:58:33 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-03-30 09:28:16 -0700 |
commit | 4ca2fd45034df255d752712a78bab917f2affc6d (patch) | |
tree | 8f37cba7c60b01da3dfcbd4dbfcff0df6b7d3dd9 /host/lib | |
parent | 1e0e079db1f54a515e061adb9967224e7b50e012 (diff) | |
download | uhd-4ca2fd45034df255d752712a78bab917f2affc6d.tar.gz uhd-4ca2fd45034df255d752712a78bab917f2affc6d.tar.bz2 uhd-4ca2fd45034df255d752712a78bab917f2affc6d.zip |
mpmd: Fixed MPM marking wrong device as reachable
During MPMd find routine, added a check when connecting to a CHDR
interface to make sure we're talking to the correct device.
Without this check MPMd would sometimes incorrectly mark a device as
reachable because they shared an addr (ie. 192.168.10.2 existed on
multiple devices).
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_mboard_impl.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp index 244fab344..8cad29f6b 100644 --- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp @@ -271,7 +271,18 @@ boost::optional<device_addr_t> mpmd_mboard_impl::is_device_reachable( "Was able to ping device, trying RPC connection."); auto chdr_rpcc = uhd::rpc_client::make(chdr_addr, rpc_port); chdr_rpcc->set_timeout(MPMD_SHORT_RPC_TIMEOUT); - chdr_rpcc->request<dev_info>("get_device_info"); + auto dev_info_chdr = chdr_rpcc->request<dev_info>("get_device_info"); + if (dev_info_chdr["serial"] != device_info_dict["serial"]) { + UHD_LOG_DEBUG("MPMD", boost::format( + "Connected to CHDR interface, but got wrong device. " + "Tried to reach serial %s, got %s") + % device_info_dict["serial"] % dev_info_chdr["serial"]); + return boost::optional<device_addr_t>(); + } else { + UHD_LOG_TRACE("MPMD", boost::format( + "Reachable device matches expected device (serial=%s)") + % device_info_dict["serial"] ); + } device_addr_t device_addr_copy = device_addr; device_addr_copy["addr"] = chdr_addr; return boost::optional<device_addr_t>(device_addr_copy); |