Skip to content

Commit c19f573

Browse files
committed
Fix TLS port bug on default mqtt validation
1 parent 5de61b1 commit c19f573

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mqtt/MQTT.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ struct PubSubConfig {
279279

280280
// Defaults
281281
static constexpr uint16_t defaultPort = 1883;
282+
static constexpr uint16_t defaultPortTls = 8883;
283+
282284
uint16_t serverPort = defaultPort;
283285
String serverAddr = default_mqtt_address;
284286
const char *mqttUsername = default_mqtt_username;
@@ -641,7 +643,7 @@ bool MQTT::isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config, MQTTC
641643
}
642644

643645
const bool defaultServer = isDefaultServer(parsed.serverAddr);
644-
if (defaultServer && parsed.serverPort != PubSubConfig::defaultPort) {
646+
if (defaultServer && !IS_ONE_OF(parsed.serverPort, PubSubConfig::defaultPort, PubSubConfig::defaultPortTls)) {
645647
const char *warning = "Invalid MQTT config: default server address must not have a port specified";
646648
LOG_ERROR(warning);
647649
#if !IS_RUNNING_TESTS

0 commit comments

Comments
 (0)