mirror of
https://github.com/agessaman/MeshCore.git
synced 2026-10-23 08:32:36 +00:00
revert(mqtt): remove IPv6 dual-stack support — measured heap exhaustion
Reverts merge ae045395 (feat/flex-ipv6, PR #25). Enabling IPv6 joins the
device into IPv6 multicast/ND processing; on multicast-heavy LANs (e.g.
with a Thread/Matter border router advertising a ULA prefix) inbound
bursts land in dynamic WiFi RX buffers in internal heap. Measured on a
Station G2 with 4 WSS brokers: min-free floor dropped 36 KB -> 18 KB,
largest free block pinned below the 16 KB publish threshold for minutes
at a time, 523 dropped publishes in 15 minutes. With IPv6 disabled the
floor and max-alloc recovered and publish skips stopped.
The feature only fed the wifi.status display line — no transport uses
IPv6 (all brokers connect over IPv4), so the fleet risk (network-
dependent degradation on unknown home LANs) buys nothing. Revisit after
the Arduino core 3.x / IDF 5.x move if IPv6 transport is ever needed;
the branch remains at feat/flex-ipv6.
Kept from the merge: the wifi.status uptime append now computes the
actual remaining space in the 160-byte reply buffer instead of assuming
a hardcoded 128, fixing a latent overflow of the snprintf bound.
This commit is contained in:
1 parent
ae045395f9
commit
ba1dbefb59
4 files changed
+5
-86
No files matched your search
@@ -780,26 +780,7 @@ bool CommonCLI::handleObserverGetCmd(uint32_t sender_timestamp, const char* conf
|
||||
default: status_str = "unknown"; break;
|
||||
}
|
||||
if (status == WL_CONNECTED) {
|
||||
// reply points at the caller's char[160] command buffer (see main.cpp).
|
||||
const size_t kReplyBufSize = 160;
|
||||
sprintf(reply, "> %s, IP: %s", status_str, WiFi.localIP().toString().c_str());
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
// Group IPv6 directly after IPv4 when a global/ULA address is assigned.
|
||||
char v6[46];
|
||||
if (MQTTBridge::getGlobalIPv6(v6, sizeof(v6))) {
|
||||
size_t v6_len = strlen(reply);
|
||||
if (v6_len < kReplyBufSize) {
|
||||
snprintf(reply + v6_len, kReplyBufSize - v6_len, ", IPv6: %s", v6);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// RSSI right after the IP addresses.
|
||||
{
|
||||
size_t rssi_len = strlen(reply);
|
||||
if (rssi_len < kReplyBufSize) {
|
||||
snprintf(reply + rssi_len, kReplyBufSize - rssi_len, ", RSSI: %d dBm", WiFi.RSSI());
|
||||
}
|
||||
}
|
||||
sprintf(reply, "> %s, IP: %s, RSSI: %d dBm", status_str, WiFi.localIP().toString().c_str(), WiFi.RSSI());
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
unsigned long connect_at = MQTTBridge::getWifiConnectedAtMillis();
|
||||
if (connect_at != 0) {
|
||||
@@ -809,6 +790,9 @@ bool CommonCLI::handleObserverGetCmd(uint32_t sender_timestamp, const char* conf
|
||||
unsigned long h = (uptime_sec % 86400) / 3600;
|
||||
unsigned long m = (uptime_sec % 3600) / 60;
|
||||
unsigned long s = uptime_sec % 60;
|
||||
// reply points at the caller's char[160] command buffer (see main.cpp);
|
||||
// compute the actual remaining space instead of assuming 128.
|
||||
const size_t kReplyBufSize = 160;
|
||||
size_t len = strlen(reply);
|
||||
const size_t reply_remaining = (len < kReplyBufSize) ? (kReplyBufSize - len) : 0;
|
||||
if (d > 0) {
|
||||
|
||||
Reference in new issue
Block a user