Check Position Request for Primary Channel (#2638)

Prevents leaking location data to secondary channels.

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Jonathan Bennett 2023-07-24 09:37:56 -05:00 committed by GitHub
parent 490abdac96
commit ac9c81f6d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,11 +52,22 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
nodeDB.updatePosition(getFrom(&mp), p);
// Only respond to location requests on the channel where we broadcast location.
if (channels.getByIndex(mp.channel).role == meshtastic_Channel_Role_PRIMARY) {
ignoreRequest = false;
} else {
ignoreRequest = true;
}
return false; // Let others look at this message also if they want
}
meshtastic_MeshPacket *PositionModule::allocReply()
{
if (ignoreRequest) {
return NULL;
}
meshtastic_NodeInfoLite *node = service.refreshLocalMeshNode(); // should guarantee there is now a position
assert(node->has_position);