lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] A question about dns_init


From: Hervé DANIEL
Subject: Re: [lwip-users] A question about dns_init
Date: Mon, 17 Oct 2011 12:08:00 +0200
User-agent: Opera Mail/11.51 (Win32)

Hi,
I check args they are correct.
If I put breaks points at each "return ERR_VAL"
the program break there:

static void
do_dns_found(const char *name, struct ip_addr *ipaddr, void *arg)
{
  struct dns_api_msg *msg = (struct dns_api_msg*)arg;

LWIP_ASSERT("DNS response for wrong host name", strcmp(msg->name, name) == 0);

  if (ipaddr == NULL) {
    /* timeout or memory error */
*msg->err = ERR_VAL; //<<<<<<<<< HERE
  } else {
    /* address was resolved */
    *msg->err = ERR_OK;
    *msg->addr = *ipaddr;
  }
  /* wake up the application task waiting in netconn_gethostbyname */
  sys_sem_signal(msg->sem);
}

In the trace we can see "dns_check_entry: "www.google.com": timeout"

--
herve.



Le Mon, 17 Oct 2011 10:22:28 +0200, Simon Goldschmidt <address@hidden> a écrit:

Having a quick look at dns.c (from v1.3.2), ERR_VAL is return if you pass invalid arguments to dns_gethostbyname:

if ((dns_pcb == NULL) || (addr == NULL) ||
    (!hostname) || (!hostname[0]) ||
    (strlen(hostname) >= DNS_MAX_NAME_LENGTH)) {
  return ERR_VAL;
}

This means wither DNS is not initialized, you did not pass an 'addr' pointer or you did not pass a correct 'hostname' (NULL or empty or too long).

Simon



"Hervé DANIEL" <address@hidden> wrote:
Hi,

netconn_gethostbyname returns the error.

I found that I call two time dns_init (alwready call with tcpip_init
before)
But it change nothing.

--
herve.


Le Sat, 15 Oct 2011 21:06:23 +0200, Kieran Mansley <address@hidden> a
écrit:

>
> On 14 Oct 2011, at 17:39, Hervé DANIEL wrote:
>
>>
>> Hi,
>>
>> I'm tring to use   netconn_gethostbyname  (LWIP1.3.2)
>>
>> I've made a basic program with this code
>>
>>  dns_init();
>>  err=netconn_gethostbyname("www.google.com", &Addr);
>>
>> and i get the adress. (what a beautifull world)
>>
>> then i copy paste to my real program (it s a web server) and i get an
>> error
>> err =  -8  : ERR_VAL
>
> What function is it that returns the error?
>
> Kieran
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]