This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf91: nrf_getaddrinfo: using AF_INET6 as ai_family results in geting 273 as return value

According to following function declaration:

/**@brief Function to resolve the host name into IPv4 and/or IPv6 addresses.
 *
 * @note The memory pointed to by @p pp_res must be freed using
 *       nrf_freeaddrinfo when the address is no longer needed
 *       or before calling nrf_getaddrinfo again.
 *
 * @param[in]  p_node     Host name to resolve.
 * @param[in]  p_service  Service to resolve.
 * @param[in]  p_hints    Any hints to be used for the resolution.
 * @param[out] pp_res     Pointer to the linked list of resolved addresses if the procedure
 *                        was successful.
 *
 * @return 0 if the procedure succeeds, else, an errno indicating the reason for failure.
 */
int nrf_getaddrinfo(const char *p_node,
		    const char *p_service,
		    const struct nrf_addrinfo *p_hints,
		    struct nrf_addrinfo **pp_res);

an error code should be returned, which indicates reason of failure. However when AF_INET6 is used as ai_family in hints argument of nrf_getaddrinfo(), value 273 is returned. This value does not map to any value from nrf_errno.h (e.g. nrfxlib/nrf_modem/include/nrf_errno.h).

I would expect to get a reason of failure, not a random value, which does not mean anything.

Parents
  • Hi,

    The error codes for nrf_getaddrinfo is defined in nrfxlib/nrf_modem/include/nrf_gai_errors.h.

    There, you will find that 273 is NRF_EAI_NONAME with the comment "NAME or SERVICE is unknown".

    Also, you should note that you should not mix Zephyr's sockets and their defines with nrf_sockets and their defines. The correct socket family for IPv6 sockets when using nrf_getaddrinfo would be NRF_AF_INET6.

    Best regards,

    Didrik

Reply
  • Hi,

    The error codes for nrf_getaddrinfo is defined in nrfxlib/nrf_modem/include/nrf_gai_errors.h.

    There, you will find that 273 is NRF_EAI_NONAME with the comment "NAME or SERVICE is unknown".

    Also, you should note that you should not mix Zephyr's sockets and their defines with nrf_sockets and their defines. The correct socket family for IPv6 sockets when using nrf_getaddrinfo would be NRF_AF_INET6.

    Best regards,

    Didrik

Children
Related