mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +00:00
Ignore and disallow multi-hop traceroutes destined to broadcast address (#6109)
* Ignore traceroutes destined to broadcast address * Disallow multi-hop traceroute request to broadcast address * Allow zero-hop broadcast requests
This commit is contained in:
parent
ec0eafedab
commit
4709d21df8
@ -643,6 +643,11 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
|
|||||||
meshtastic_QueueStatus qs = router->getQueueStatus();
|
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||||
service->sendQueueStatusToPhone(qs, 0, p.id);
|
service->sendQueueStatusToPhone(qs, 0, p.id);
|
||||||
return false;
|
return false;
|
||||||
|
} else if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && isBroadcast(p.to) && p.hop_limit > 0) {
|
||||||
|
sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "Multi-hop traceroute to broadcast address is not allowed");
|
||||||
|
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||||
|
service->sendQueueStatusToPhone(qs, 0, p.id);
|
||||||
|
return false;
|
||||||
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
||||||
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
|
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
|
||||||
LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
|
LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
|
||||||
|
@ -150,6 +150,12 @@ meshtastic_MeshPacket *TraceRouteModule::allocReply()
|
|||||||
{
|
{
|
||||||
assert(currentRequest);
|
assert(currentRequest);
|
||||||
|
|
||||||
|
// Ignore multi-hop broadcast requests
|
||||||
|
if (isBroadcast(currentRequest->to) && currentRequest->hop_limit < currentRequest->hop_start) {
|
||||||
|
ignoreRequest = true;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the payload of the current request
|
// Copy the payload of the current request
|
||||||
auto req = *currentRequest;
|
auto req = *currentRequest;
|
||||||
const auto &p = req.decoded;
|
const auto &p = req.decoded;
|
||||||
|
Loading…
Reference in New Issue
Block a user