Getaddrinfo fail inside the mqttClientService

Hi,

I’m using legatos built in mqttClientService to connect to an external MQTT broker. However I can only provide ip address to the mqttClient_CreateSession.

If I try to use domain for that server, I receive:

mqttClientService[6672] | 20241023 062637.556 getaddrinfo failed for addr <url> with rc -2
mqttClientService[6672] | 20241023 062637.556 <url> is not a valid IP address

If i fetch the IP address on my own with getaddrinfo right before mqttClient_CreateSession, it returns IP address just fine and I can use it to connect to broker. The problem is that I can’t use ssl that way.

Seems like the mqttClientService cannot use dns or /etc/resolv.conf correctly.
I’m using legato 19.11.2 and my app is not sandboxed.

Any idea how to make mqttClientService understand domains?

you can see this document:

SSL application should be OK to find the IP address

Thanks,
I can try to use ssl with IP address.

However, using my own code to resolve server IP address is a bit whacky solution. Do you have any idea why getaddrinfo fails inside mqttClientService though it worked on my own code just a few lines earlier?

here says it is fixed after legato 20.04:

I assume you are using WP76 module, have you tried in FW17 of WP76 which is using legato 21.05?

(Bear in mind that once module upgraded to FW R17, you cannot go back to FW R16.x)

In vscode leaf environment, I have these packages installed in the profile.

"packages": {
    "swi-wp76": "5.0.0",
    "wp76-image": "5.0.0"
}

Does the firmware update if I change those to use newer version? e.g. 6.0.0?
And does the firmware update with the OTA update (.update file)?

I have tried to use the newer 6.0.0 but there is some problems with build that I have not figured out yet. But if I can use my own dns resolve at the moment, I try to update the legato version later.

you need to update the firmware of the module to R17 first, and then you need to recompile your legato application in leaf to use the package swi-wp76_6.0.0 which is for the legato version of R17:
https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-17/#sthash.SnT6fF1l.dpbs

Firmware update is using spk file, not .update file

Is it possible to update firmware and legato system with a single file or do I need to update firmware.spk and .update separately?

then you need to embed your application into legato.cwe

After that combine the legato.cwe with modem and yocto and mcu image into one image by swicwe tool:

https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-17-components/#sthash.fdXjPVgZ.dpbs

https://source.sierrawireless.com/resources/airprime/software/swicwe/

Of course, updating the official spk file and then just update you .update file will be easier for you