From 4ca2fd45034df255d752712a78bab917f2affc6d Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Thu, 29 Mar 2018 18:58:33 -0700 Subject: 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). --- host/lib/usrp/mpmd/mpmd_mboard_impl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/mpmd/mpmd_mboard_impl.cpp') 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 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("get_device_info"); + auto dev_info_chdr = chdr_rpcc->request("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(); + } 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_copy); -- cgit v1.2.3