dns_init()
{
  ip_addr_t dnsserver;

  LWIP_ASSERT("sanity check SIZEOF_DNS_QUERY",
    sizeof(struct dns_query) == SIZEOF_DNS_QUERY);
  LWIP_ASSERT("sanity check SIZEOF_DNS_ANSWER",
    sizeof(struct dns_answer) <= SIZEOF_DNS_ANSWER_ASSERT);

  dns_payload = (u8_t *)LWIP_MEM_ALIGN(dns_payload_buffer);

  /* initialize default DNS server address */
  DNS_SERVER_ADDRESS(&dnsserver);

  LWIP_DEBUGF(DNS_DEBUG, ("dns_init: initializing\n"));

  /* if dns client not yet initialized... */
#if ((LWIP_DNS_SECURE & LWIP_DNS_SECURE_RAND_SRC_PORT) == 0)
  if (dns_pcbs[0] == NULL) {
    dns_pcbs[0] = udp_new();
    LWIP_ASSERT("dns_pcbs[0] != NULL", dns_pcbs[0] != NULL);

    /* initialize DNS table not needed (initialized to zero since it is a
     * global variable) */
    LWIP_ASSERT("For implicit initialization to work, DNS_STATE_UNUSED needs to be 0",
      DNS_STATE_UNUSED == 0);

    /* initialize DNS client */
    udp_bind(dns_pcbs[0], IP_ADDR_ANY, 0);
    udp_recv(dns_pcbs[0], dns_recv, NULL);
  }
#endif
  /* initialize default DNS primary server */
  dns_setserver(0, &dnsserver);
#if DNS_LOCAL_HOSTLIST
  dns_init_local();
#endif
}
dns_init()
{
  ip_addr_t dnsserver;

  LWIP_ASSERT("sanity check SIZEOF_DNS_QUERY",
    sizeof(struct dns_query) == SIZEOF_DNS_QUERY);
  LWIP_ASSERT("sanity check SIZEOF_DNS_ANSWER",
    sizeof(struct dns_answer) <= SIZEOF_DNS_ANSWER_ASSERT);

  dns_payload = (u8_t *)LWIP_MEM_ALIGN(dns_payload_buffer);

   
  DNS_SERVER_ADDRESS(&dnsserver);

  LWIP_DEBUGF(DNS_DEBUG, ("dns_init: initializing\n"));

   
#if ((LWIP_DNS_SECURE & LWIP_DNS_SECURE_RAND_SRC_PORT) == 0)
  if (dns_pcbs[0] == NULL) {
    dns_pcbs[0] = udp_new();
    LWIP_ASSERT("dns_pcbs[0] != NULL", dns_pcbs[0] != NULL);

     
    LWIP_ASSERT("For implicit initialization to work, DNS_STATE_UNUSED needs to be 0",
      DNS_STATE_UNUSED == 0);

     
    udp_bind(dns_pcbs[0], IP_ADDR_ANY, 0);
    udp_recv(dns_pcbs[0], dns_recv, NULL);
  }
#endif
   
  dns_setserver(0, &dnsserver);
#if DNS_LOCAL_HOSTLIST
  dns_init_local();
#endif
}