don't send messages the phone sent us back towards the phone

This commit is contained in:
Kevin Hester
2021-03-05 10:19:27 +08:00
parent 2f6034b067
commit 950b32232f
20 changed files with 87 additions and 58 deletions

View File

@@ -111,7 +111,7 @@ void Router::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom)
void Router::abortSendAndNak(Routing_Error err, MeshPacket *p)
{
DEBUG_MSG("Error=%d, returning NAK and dropping packet.\n", err);
sendAckNak(Routing_Error_NO_INTERFACE, p->from, p->id);
sendAckNak(Routing_Error_NO_INTERFACE, getFrom(p), p->id);
packetPool.release(p);
}
@@ -155,6 +155,10 @@ ErrorCode Router::send(MeshPacket *p)
if (p->to == NODENUM_BROADCAST)
p->want_ack = false;
// Up until this point we might have been using 0 for the from address (if it started with the phone), but when we send over
// the lora we need to make sure we have replaced it with our local address
p->from = getFrom(p);
// If the packet hasn't yet been encrypted, do so now (it might already be encrypted if we are just forwarding it)
assert(p->which_payloadVariant == MeshPacket_encrypted_tag ||
@@ -273,7 +277,7 @@ void Router::handleReceived(MeshPacket *p)
void Router::perhapsHandleReceived(MeshPacket *p)
{
assert(radioConfig.has_preferences);
bool ignore = is_in_repeated(radioConfig.preferences.ignore_incoming, p->from);
bool ignore = is_in_repeated(radioConfig.preferences.ignore_incoming, getFrom(p));
if (ignore)
DEBUG_MSG("Ignoring incoming message, 0x%x is in our ignore list\n", p->from);