Commit graph

6 commits

Author SHA1 Message Date
Andy Taylor 139d9dbff5 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:32 +00:00
Andy Taylor 50a3567335 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 a client ID ending in .0, causing collisions
when multiple instances or restarts occur.

Replace time()-based client IDs with PID-based IDs using getpid(), which is
always a portable 32-bit value and unique per process. Platform-guarded for
Windows (_getpid) and POSIX (getpid).
2026-03-08 12:51:36 +00:00
Jonathan Naylor 538108b192 Add optional MQTT authentication. 2025-03-21 17:37:30 +00:00
Jonathan Naylor a2e2ea3675 Linux cleanups. 2025-03-17 14:29:13 +00:00
Jonathan Naylor 4ff688045f Update the C++ version and other changes. 2025-03-17 14:09:42 +00:00
Jonathan Naylor 04146faa81 Convert to use of MQTT for command, APRS, and dynamic TG control. 2023-07-07 11:14:34 +01:00