[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] DNS for socket API
From: |
Pettinato, Jim |
Subject: |
RE: [lwip-users] DNS for socket API |
Date: |
Tue, 8 Sep 2009 10:52:59 -0400 |
Sorry for assuming the simplest source of your problem - I pretty much strictly
use the raw API, so am less familiar with the socket / netconn API.
Can you verify that the DHCP-returned DNS server IP is being stored properly?
It should be stuffed into dns.c's static array variable dns_servers[0].
There are at minimum the following memory requirements for DNS to work... You
need an available UDP pcb, one open entry in the DNS table (i.e. DNS_TABLE_SIZE
large enough for all resolved names) and some free pbufs in the pool to send
the packet.
Is dns_send() getting called or is it not getting that far?
Do you have stats enabled? Any allocation errors should show up in the
associated memory structure's stats.
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Mathias Zenger
Sent: Tuesday, September 08, 2009 10:33 AM
To: address@hidden
Subject: WG: [lwip-users] DNS for socket API
Thanks for your hint. I dug even deeper but still wasn't successful. At the end
I was able to break in
do_dns_found(const char *name, struct ip_addr *ipaddr, void *arg)
This method returns ERR_VAL (-8) which says "timeout or memory error" or
"illegal value" or "dns server response was invalid" respectively (depending on
different method comments).
I guess that my name argument is OK. At least my debugger resolves the name
pointer to "ntpbmt01.dyndns.org" which is the desired server. The second
argument (addr) gets defined in netconn_gethostbyname(). I am only passing the
name pointer to gethostbyname(). Could there anyway be a problem with the
memory (e.g. a missing memory allocation / lwIP configuration setting)?
Still there is no DNS packet output which I would expect to see after the call
of dns_enqueue()...
-----Ursprüngliche Nachricht-----
Von: Pettinato, Jim [mailto:address@hidden
Gesendet: Freitag, 4. September 2009 17:27
An: address@hidden; Mailing list for lwIP users
Betreff: RE: [lwip-users] DNS for socket API
-8 (ERR_ARG) would appear to indicate that the netconn_gethostbyname() function
is being passed either a NULL pointer for the name to look up, or a NULL
pointer for the destination to write the resolved IP address. Check your
arguments to the call; my guess would be perhaps you are a level of indirection
off on your addr argument (i.e. passing the value instead of the address of
your ip_addr variable).
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Mathias Zenger
Sent: Friday, September 04, 2009 10:40 AM
To: Mailing list for lwIP users
Subject: AW: [lwip-users] DNS for socket API
Hi,
I am working on my 'problem' again.
My call of gethostbyname() after a few seconds always returns NULL. I set a
breakpoint within this function and saw that
err = netconn_gethostbyname(name, &addr);
returns the error code -8. Unfortunately I still don't know what I am doing
wrong. DHCP works fine and gives the correct DNS server address. LWIP_DNS is
set to 1. There is no packet output from my device to the DNS server at all (no
packet captured with Wireshark). Is there a special need to 'somehow handle'
the DNS server address?
To solve my previous problems I replaced the netdb.c/h files in my stack.
Afterwards the compiler errors/warnings disappeared. Was it a bad idea to just
replace the two 1.3.0 files by the 1.3.1 version?
Any other ideas? Thanks.
Regards,
Mathias
-----Ursprüngliche Nachricht-----
Von: address@hidden
[mailto:address@hidden Auftrag von address@hidden
Gesendet: Dienstag, 11. August 2009 16:41
An: Mailing list for lwIP users
Betreff: Re: [lwip-users] DNS for socket API
Simon Goldschmidt wrote:
>> In netdb.c I get some warnings for implicit declarations of strlen(),
>> memcpy() and memset(). This probably could indicate a missing
>> string.h include.
>>
> That could well be as I think the example ports include string.h in
> their
port-defined cc.h file. Just try to add the missing include in netdb.c until we
added it to CVS.
>
I've just added #include <string.h> to netdb.c in CVS.
>> The error in netdb.c says 'conflicting types for lwip_gethostbyname_r'.
In
>> netdb.h I get the error messages 'previous declaration of
>> lwip_gethostbyname_r was here' and 'expected declaration specifiers
>> or '...'
>> before size_t'
>>
>
> That would mean another standard include is missing in netdb.h. I'll
> check
that.
>
#include <stddef.h> was added to netdb.h 2 weeks ago.
Simon
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users