ESP-TLS couldn't get hostname over bridged network (MQTT)
Posted: Fri Oct 22, 2021 8:28 pm
Hello everyone!
I'm using a raspberrypi as a mosquitto broker, it also runs grafana, influxdb and nodered.
Since the raspberry is in the same room as the ESP32 that sends sensors values over mqtt, and this room is too far to be reached from a wifi repeater, I'm using a powerline to bring ethernet to this room, and the raspberry is configured to bridge the ethernet connection over wifi through its integrated wifi adapter.
Everything worked fine for months, but then I moved, and had to change the internet provider and the modem/router.
Since that moment the system stopped working, I always get this errors
Mqtt is configured to use SSL, so I HAVE to use the hostname of the raspberry as .host parameter, since i generated the certificates using that hostname.
What drives me crazy is that every other device I connect to the wifi generated by the raspberry can resolve correctly the hostname, I tried PCs and a smarphones and all were able to resolve "raspberrypi".
Also, everyone in the network (even outside the bridge) can resolve "espressif"
So there must be an issue with the esp32, but I can't understand where to look, even the verbose log doesn't state more than the lines I pasted above.
What am I missing? My project is quite big, and I don't know what to show you, so please tell me what infos or code you need to help me, and I'll provide them. I'm using esp idf 4.2.
Thank you in advance!
I'm using a raspberrypi as a mosquitto broker, it also runs grafana, influxdb and nodered.
Since the raspberry is in the same room as the ESP32 that sends sensors values over mqtt, and this room is too far to be reached from a wifi repeater, I'm using a powerline to bring ethernet to this room, and the raspberry is configured to bridge the ethernet connection over wifi through its integrated wifi adapter.
Everything worked fine for months, but then I moved, and had to change the internet provider and the modem/router.
Since that moment the system stopped working, I always get this errors
Code: Select all
I (386933) MQTT_SERVICE: Other event id:7
E (386973) esp-tls: couldn't get hostname for :raspberrypi:
E (386973) esp-tls: Failed to open new connection
E (386973) TRANS_SSL: Failed to open a new connection
E (386983) MQTT_CLIENT: Error transport connect
I (386983) MQTT_SERVICE: MQTT_EVENT_ERROR
I (386993) MQTT_SERVICE: MQTT_EVENT_DISCONNECTED
Code: Select all
const esp_mqtt_client_config_t mqtt_cfg = {
.host = "raspberrypi",
.port = 8883,
.transport = MQTT_TRANSPORT_OVER_SSL,
.event_handle = mqtt_event_handler,
//.use_global_ca_store = true,
.cert_pem = ca_cert,
.client_cert_pem = esp_cert,
.client_key_pem = esp_key,
.username = "xxxx",
.password = "****"
};
Also, everyone in the network (even outside the bridge) can resolve "espressif"
So there must be an issue with the esp32, but I can't understand where to look, even the verbose log doesn't state more than the lines I pasted above.
What am I missing? My project is quite big, and I don't know what to show you, so please tell me what infos or code you need to help me, and I'll provide them. I'm using esp idf 4.2.
Thank you in advance!