mirror of
https://github.com/meshtastic/firmware.git
synced 2026-10-10 07:38:42 -04:00
Merge upstream develop into packet authentication policy
This commit is contained in:
commit
08cfb3d683
74 files changed
+836
-939
No files matched your search
+27
-15
@@ -177,6 +177,9 @@ bool NextHopRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p->to == NODENUM_BROADCAST_NO_LORA)
|
||||
return false;
|
||||
|
||||
// Allow rebroadcast if hop_limit > 0 OR if we're exhausting hops (which sets hop_limit = 0 but still needs one relay)
|
||||
if (!isToUs(p) && !isFromUs(p) && (p->hop_limit > 0 || exhaustHops)) {
|
||||
if (p->id != 0) {
|
||||
@@ -210,11 +213,10 @@ bool NextHopRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p->next_hop == NO_NEXT_HOP_PREFERENCE) {
|
||||
FloodingRouter::send(tosend);
|
||||
} else {
|
||||
NextHopRouter::send(tosend);
|
||||
}
|
||||
ErrorCode res =
|
||||
(p->next_hop == NO_NEXT_HOP_PREFERENCE) ? FloodingRouter::send(tosend) : NextHopRouter::send(tosend);
|
||||
if (res == ERRNO_SHOULD_RELEASE)
|
||||
packetPool.release(tosend);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -419,8 +421,10 @@ int32_t NextHopRouter::doRetransmissions()
|
||||
trafficManagementModule->clearNextHop(p.packet->to);
|
||||
}
|
||||
#endif
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet))
|
||||
FloodingRouter::send(copy);
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet)) {
|
||||
if (FloodingRouter::send(copy) == ERRNO_SHOULD_RELEASE)
|
||||
packetPool.release(copy);
|
||||
}
|
||||
} else {
|
||||
#if NEXTHOP_EARLY_FLOOD_ON_UNVERIFIED
|
||||
// M4 (gated): if the route isn't proven healthy, don't spend a second directed
|
||||
@@ -434,22 +438,30 @@ int32_t NextHopRouter::doRetransmissions()
|
||||
meshtastic_NodeInfoLite *sentTo = nodeDB->getMeshNode(p.packet->to);
|
||||
if (sentTo)
|
||||
sentTo->next_hop = NO_NEXT_HOP_PREFERENCE;
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet))
|
||||
FloodingRouter::send(copy);
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet)) {
|
||||
if (FloodingRouter::send(copy) == ERRNO_SHOULD_RELEASE)
|
||||
packetPool.release(copy);
|
||||
}
|
||||
} else {
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet))
|
||||
NextHopRouter::send(copy);
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet)) {
|
||||
if (NextHopRouter::send(copy) == ERRNO_SHOULD_RELEASE)
|
||||
packetPool.release(copy);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet))
|
||||
NextHopRouter::send(copy);
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet)) {
|
||||
if (NextHopRouter::send(copy) == ERRNO_SHOULD_RELEASE)
|
||||
packetPool.release(copy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
// Note: we call the superclass version because we don't want to have our version of send() add a new
|
||||
// retransmission record
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet))
|
||||
FloodingRouter::send(copy);
|
||||
if (auto *copy = packetPool.allocCopy(*p.packet)) {
|
||||
if (FloodingRouter::send(copy) == ERRNO_SHOULD_RELEASE)
|
||||
packetPool.release(copy);
|
||||
}
|
||||
}
|
||||
|
||||
// Queue again
|
||||
|
||||
Reference in new issue
Block a user