From c3469f5fb6c7db2da54281eb8ddb463a3d1295ae Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Mon, 21 Feb 2022 21:05:01 -0500 Subject: [PATCH] Legacy: Fix icsneoGetNetidforSlaveVNETs The NetID is written to the out* parameter, not returned. --- api/icsneolegacy/icsneolegacy.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/api/icsneolegacy/icsneolegacy.cpp b/api/icsneolegacy/icsneolegacy.cpp index 6599f30..bb482ec 100644 --- a/api/icsneolegacy/icsneolegacy.cpp +++ b/api/icsneolegacy/icsneolegacy.cpp @@ -147,16 +147,20 @@ static inline bool IdIsSlaveBRange2(unsigned int fullNetid) return Within(fullNetid, PLASMA_SLAVE2_OFFSET_RANGE2, PLASMA_SLAVE3_OFFSET_RANGE2); } -static inline unsigned int GetVnetNetid(size_t simpleNetId, EPlasmaIonVnetChannel_t vnetSlot) +static inline bool GetVnetNetid(size_t& netId, EPlasmaIonVnetChannel_t vnetSlot) { - if (vnetSlot == 0 || vnetSlot >= sizeof(vnet_table)/sizeof(vnet_table[0])) - return simpleNetId; + if (vnetSlot == 0) + return true; - const auto offset = mp_netIDToVnetOffSet.find(simpleNetId); + if (vnetSlot >= sizeof(vnet_table)/sizeof(vnet_table[0])) + return false; + + const auto offset = mp_netIDToVnetOffSet.find(netId); if (offset == mp_netIDToVnetOffSet.end()) - return simpleNetId; + return false; - return offset->second + vnet_table[vnetSlot]; + netId = offset->second + vnet_table[vnetSlot]; + return true; } /**