nwm_uds: Make sure client node information match host's
This change is not HW tested as I do not have 3 3DSes, but this should make sure that all the members of the network hold the same `node_info`, `nodes` and the bitmasks, etc.
This commit is contained in:
parent
4918f86622
commit
9965ce6938
|
@ -266,13 +266,18 @@ void NWM_UDS::HandleEAPoLPacket(const Network::WifiPacket& packet) {
|
||||||
connection_status.max_nodes = logoff.max_nodes;
|
connection_status.max_nodes = logoff.max_nodes;
|
||||||
|
|
||||||
node_info.clear();
|
node_info.clear();
|
||||||
node_info.reserve(network_info.max_nodes);
|
node_info.resize(network_info.max_nodes);
|
||||||
for (std::size_t index = 0; index < logoff.connected_nodes; ++index) {
|
for (const auto& node : logoff.nodes) {
|
||||||
connection_status.node_bitmask |= 1 << index;
|
const u16 index = node.network_node_id;
|
||||||
connection_status.changed_nodes |= 1 << index;
|
if (!index) {
|
||||||
connection_status.nodes[index] = logoff.nodes[index].network_node_id;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
node_info.emplace_back(DeserializeNodeInfo(logoff.nodes[index]));
|
connection_status.node_bitmask |= 1 << (index - 1);
|
||||||
|
connection_status.changed_nodes |= 1 << (index - 1);
|
||||||
|
connection_status.nodes[index - 1] = index;
|
||||||
|
|
||||||
|
node_info[index - 1] = DeserializeNodeInfo(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're now connected, signal the application
|
// We're now connected, signal the application
|
||||||
|
@ -291,17 +296,26 @@ void NWM_UDS::HandleEAPoLPacket(const Network::WifiPacket& packet) {
|
||||||
|
|
||||||
network_info.total_nodes = logoff.connected_nodes;
|
network_info.total_nodes = logoff.connected_nodes;
|
||||||
connection_status.total_nodes = logoff.connected_nodes;
|
connection_status.total_nodes = logoff.connected_nodes;
|
||||||
|
std::memset(connection_status.nodes, 0, sizeof(connection_status.nodes));
|
||||||
|
|
||||||
|
const auto old_bitmask = connection_status.node_bitmask;
|
||||||
|
connection_status.node_bitmask = 0;
|
||||||
|
|
||||||
node_info.clear();
|
node_info.clear();
|
||||||
node_info.reserve(network_info.max_nodes);
|
node_info.resize(network_info.max_nodes);
|
||||||
for (std::size_t index = 0; index < logoff.connected_nodes; ++index) {
|
for (const auto& node : logoff.nodes) {
|
||||||
if ((connection_status.node_bitmask & (1 << index)) == 0) {
|
const u16 index = node.network_node_id;
|
||||||
connection_status.changed_nodes |= 1 << index;
|
if (!index) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
connection_status.nodes[index] = logoff.nodes[index].network_node_id;
|
|
||||||
connection_status.node_bitmask |= 1 << index;
|
connection_status.node_bitmask |= 1 << (index - 1);
|
||||||
node_info.emplace_back(DeserializeNodeInfo(logoff.nodes[index]));
|
connection_status.nodes[index - 1] = index;
|
||||||
|
|
||||||
|
node_info[index - 1] = DeserializeNodeInfo(node);
|
||||||
}
|
}
|
||||||
|
connection_status.changed_nodes = old_bitmask ^ connection_status.node_bitmask;
|
||||||
|
|
||||||
connection_status_event->Signal();
|
connection_status_event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ std::vector<u8> GenerateEAPoLLogoffFrame(const MacAddress& mac_address, u16 netw
|
||||||
eapol_logoff.connected_nodes = total_nodes;
|
eapol_logoff.connected_nodes = total_nodes;
|
||||||
eapol_logoff.max_nodes = max_nodes;
|
eapol_logoff.max_nodes = max_nodes;
|
||||||
|
|
||||||
for (std::size_t index = 0; index < total_nodes; ++index) {
|
for (std::size_t index = 0; index < max_nodes; ++index) {
|
||||||
const auto& node_info = nodes[index];
|
const auto& node_info = nodes[index];
|
||||||
auto& node = eapol_logoff.nodes[index];
|
auto& node = eapol_logoff.nodes[index];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue