|
|
|
@ -326,7 +326,7 @@ int SensorMesh::getAGCResetInterval() const { |
|
|
|
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
|
|
|
} |
|
|
|
|
|
|
|
uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data) { |
|
|
|
uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data, bool is_flood) { |
|
|
|
ClientInfo* client; |
|
|
|
if (data[0] == 0) { // blank password, just check if sender is in ACL
|
|
|
|
client = acl.getClient(sender.pub_key, PUB_KEY_SIZE); |
|
|
|
@ -359,6 +359,10 @@ uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* |
|
|
|
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY); |
|
|
|
} |
|
|
|
|
|
|
|
if (is_flood) { |
|
|
|
client->out_path_len = -1; // need to rediscover out_path
|
|
|
|
} |
|
|
|
|
|
|
|
uint32_t now = getRTCClock()->getCurrentTimeUnique(); |
|
|
|
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
|
|
|
reply_data[4] = RESP_SERVER_LOGIN_OK; |
|
|
|
@ -451,7 +455,7 @@ void SensorMesh::onAnonDataRecv(mesh::Packet* packet, const uint8_t* secret, con |
|
|
|
data[len] = 0; // ensure null terminator
|
|
|
|
uint8_t reply_len; |
|
|
|
if (data[4] == 0 || data[4] >= ' ') { // is password, ie. a login request
|
|
|
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4]); |
|
|
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4], packet->isRouteFlood()); |
|
|
|
//} else if (data[4] == ANON_REQ_TYPE_*) { // future type codes
|
|
|
|
// TODO
|
|
|
|
} else { |
|
|
|
|