mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-19 16:29:31 +00:00
Merge branch 'master' into ch341
This commit is contained in:
commit
ccb8074f28
@ -178,12 +178,11 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
|||||||
{
|
{
|
||||||
meshtastic_Channel &ch = getByIndex(chIndex);
|
meshtastic_Channel &ch = getByIndex(chIndex);
|
||||||
const meshtastic_ChannelSettings &channelSettings = ch.settings;
|
const meshtastic_ChannelSettings &channelSettings = ch.settings;
|
||||||
assert(ch.has_settings);
|
|
||||||
|
|
||||||
CryptoKey k;
|
CryptoKey k;
|
||||||
memset(k.bytes, 0, sizeof(k.bytes)); // In case the user provided a short key, we want to pad the rest with zeros
|
memset(k.bytes, 0, sizeof(k.bytes)); // In case the user provided a short key, we want to pad the rest with zeros
|
||||||
|
|
||||||
if (ch.role == meshtastic_Channel_Role_DISABLED) {
|
if (!ch.has_settings || ch.role == meshtastic_Channel_Role_DISABLED) {
|
||||||
k.length = -1; // invalid
|
k.length = -1; // invalid
|
||||||
} else {
|
} else {
|
||||||
memcpy(k.bytes, channelSettings.psk.bytes, channelSettings.psk.size);
|
memcpy(k.bytes, channelSettings.psk.bytes, channelSettings.psk.size);
|
||||||
|
@ -36,7 +36,8 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||||||
if (isRepeated) {
|
if (isRepeated) {
|
||||||
LOG_DEBUG("Repeated reliable tx");
|
LOG_DEBUG("Repeated reliable tx");
|
||||||
if (!perhapsRebroadcast(p) && isToUs(p) && p->want_ack) {
|
if (!perhapsRebroadcast(p) && isToUs(p) && p->want_ack) {
|
||||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, 0);
|
// FIXME - channel index should be used, but the packet is still encrypted here
|
||||||
|
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,6 +271,7 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
|
|||||||
auto encodeResult = perhapsEncode(p);
|
auto encodeResult = perhapsEncode(p);
|
||||||
if (encodeResult != meshtastic_Routing_Error_NONE) {
|
if (encodeResult != meshtastic_Routing_Error_NONE) {
|
||||||
packetPool.release(p_decoded);
|
packetPool.release(p_decoded);
|
||||||
|
p->channel = 0; // Reset the channel to 0, so we don't use the failing hash again
|
||||||
abortSendAndNak(encodeResult, p);
|
abortSendAndNak(encodeResult, p);
|
||||||
return encodeResult; // FIXME - this isn't a valid ErrorCode
|
return encodeResult; // FIXME - this isn't a valid ErrorCode
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user