Commit graph

15 commits

Author SHA1 Message Date
Andy Taylor
469306ff1f Add mosquitto_loop_stop before mosquitto_destroy in close()
The background network thread started by mosquitto_loop_start() was not
being stopped before mosquitto_destroy(), which can cause a use-after-free
if the thread is still running when the mosquitto structure is freed.
2026-03-08 14:16:34 +00:00
Andy Taylor
8efcac05e6 Fix MQTT client ID collision on ARM 32-bit userland with 64-bit kernel
The MQTT client ID was generated using sprintf with %ld and time(nullptr).
On platforms with 32-bit userland but 64-bit kernel (such as Raspberry Pi OS
and some custom Alpine Linux builds), time_t is a 64-bit long long but %ld
only reads 32 bits. Since the upper 32 bits of the current Unix timestamp
are zero, this always produces "MMDVMHost.0", causing client ID collisions
when multiple instances or restarts occur.

Replace time()-based client IDs with PID-based IDs using getpid(), which is
always a 32-bit value and unique per process. Platform-guarded for Windows
(_getpid) and POSIX (getpid).
2026-03-08 12:49:26 +00:00
Jonathan Naylor
7a192b2c6b
Update MQTTConnection.cpp 2025-03-18 16:05:30 +00:00
Jonathan Naylor
782bab0a14 Linux cleanups. 2025-03-17 14:30:44 +00:00
Jonathan Naylor
9fdef7f95a Change the MQTT connection name to be random. 2025-03-17 12:22:07 +00:00
Jonathan Naylor
3109cd03ae Clean ups from merging from master. 2025-03-14 16:11:04 +00:00
Jonathan Naylor
088a62789f Use a random id for MQTT and change the order of some startup messages. 2025-03-12 13:25:26 +00:00
Jonathan Naylor
f9a5a169cb Clean up the MQTT connection authentication configuration. 2025-03-03 15:02:47 +00:00
William Peters
d8973509ba Added Authentication for MQTT 2025-01-17 16:34:51 +01:00
Jonathan Naylor
052af9ce93 Merge branch 'master' into mqtt 2024-09-30 18:53:33 +01:00
Jonathan Naylor
9b9b70eec7 Handle changes to the MQTT class API. 2023-07-05 11:37:33 +01:00
Jonathan Naylor
fddabee1b9 Update the MQTT and JSON handling slightly. 2023-07-04 17:08:11 +01:00
Jonathan Naylor
3c48b8f61b Add support for passthrough of serial data from MQTT to the spare serial port on an MMDVM modem/hotspot. 2023-06-20 16:33:33 +01:00
Jonathan Naylor
0615a4218d Add MQTT subscriptions for display and remote commands. 2023-06-19 17:16:14 +01:00
Jonathan Naylor
ff004211b9 Rename MQTTPublisher to MQTTConnection. 2023-06-19 14:57:30 +01:00
Renamed from MQTTPublisher.cpp (Browse further)