Improve repeater reliability and build tooling
This commit is contained in:
1 parent
2b4aed4ef1
commit
da00a00436
31 files changed
+1079
-229
No files matched your search
@@ -360,6 +360,10 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
|
||||
}
|
||||
|
||||
client = acl.putClient(sender, 0); // add to known clients (if not already known)
|
||||
if (client == NULL) {
|
||||
MESH_DEBUG_PRINTLN("Login rejected: ACL is full of protected contacts");
|
||||
return;
|
||||
}
|
||||
if (sender_timestamp <= client->last_timestamp) {
|
||||
MESH_DEBUG_PRINTLN("possible replay attack!");
|
||||
return;
|
||||
@@ -1013,13 +1017,14 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
|
||||
if (sp == NULL) {
|
||||
strcpy(reply, "Err - bad params");
|
||||
} else {
|
||||
size_t hex_len = (size_t)(sp - hex);
|
||||
*sp++ = 0; // replace space with null terminator
|
||||
|
||||
uint8_t pubkey[PUB_KEY_SIZE];
|
||||
int hex_len = min(sp - hex, PUB_KEY_SIZE*2);
|
||||
if (mesh::Utils::fromHex(pubkey, hex_len / 2, hex)) {
|
||||
if (hex_len > 0 && hex_len <= PUB_KEY_SIZE * 2 && (hex_len & 1) == 0
|
||||
&& mesh::Utils::fromHex(pubkey, (int)(hex_len / 2), hex)) {
|
||||
uint8_t perms = atoi(sp);
|
||||
if (acl.applyPermissions(self_id, pubkey, hex_len / 2, perms)) {
|
||||
if (acl.applyPermissions(self_id, pubkey, (int)(hex_len / 2), perms)) {
|
||||
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY); // trigger acl.save()
|
||||
strcpy(reply, "OK");
|
||||
} else {
|
||||
@@ -1120,7 +1125,7 @@ void MyMesh::loop() {
|
||||
MESH_DEBUG_PRINTLN("Temp radio params");
|
||||
}
|
||||
|
||||
if (revert_radio_at && millisHasNowPassed(revert_radio_at)) { // revert radio params to orig
|
||||
if (revert_radio_at && millisHasNowPassed(revert_radio_at) && !hasOutbound()) { // revert radio params to orig
|
||||
revert_radio_at = 0; // clear timer
|
||||
radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
|
||||
MESH_DEBUG_PRINTLN("Radio params restored");
|
||||
|
||||
@@ -140,7 +140,9 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
||||
|
||||
protected:
|
||||
#if defined(ENABLE_OTA)
|
||||
bool isTempRadioActive() const override { return set_radio_at == 0 && revert_radio_at != 0; }
|
||||
bool isTempRadioActive() const override {
|
||||
return set_radio_at == 0 && revert_radio_at != 0 && !millisHasNowPassed(revert_radio_at);
|
||||
}
|
||||
#endif
|
||||
float getAirtimeBudgetFactor() const override {
|
||||
return _prefs.airtime_factor;
|
||||
|
||||
@@ -127,6 +127,9 @@ void loop() {
|
||||
#endif
|
||||
if (the_mesh.getNodePrefs()->powersaving_enabled && !board.isUsbDataConnected()) {
|
||||
uint32_t sleep_secs = the_mesh.getPowerSaveSleepSeconds(30);
|
||||
#ifdef HAS_EXTERNAL_WATCHDOG
|
||||
if (sleep_secs > 0) external_watchdog.feed();
|
||||
#endif
|
||||
#if defined(NRF52_PLATFORM)
|
||||
if (sleep_secs > 0) {
|
||||
board.sleep(0); // nrf ignores seconds param, sleeps whenever possible
|
||||
|
||||
Reference in new issue
Block a user