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

MbedTLS Keil PACK V1.1.1 - problems with source code

Hi,
I think I may have found a bug in the "net.c" file (snippet of code shown below) where the function "netDNSc_GetHostByName" always returns "netInvalidParameter".

This is caused by the variable "addr_type" not being set before being passed to "netDNSc_GetHostByName".

I have looked at the latest source code on github but looks like the Keil pack does not have the latest changes with regard to this function.

Any help on best way forward would be appreciated.
Thanks.

/*
 * Initiate a TCP connection with host:port and the given protocol
 */
int mbedtls_net_connect (mbedtls_net_context *ctx, const char *host, const char *port, int proto) {
  SOCKADDR_IN6 host_addr;
  netStatus stat;
  int16_t addr_type;
  uint16_t port_nr;
  int ret;

  if ((ret = net_prepare ()) != 0) {
    return (ret);
  }

  /* Do name resolution with both IPv6 and IPv4 */
  SOCK_ADDR(&host_addr)->sa_family = AF_UNSPEC;
  dns_addr = SOCK_ADDR(&host_addr);
  while (1) {
    stat = netDNSc_GetHostByName (host, addr_type, dns_cbfunc);
    if (stat == netBusy) {
      osDelay (100);
      continue;
    }
...