Hi
I can't seem to get DNS functionality to work!!
I've tried building the secure email demo program, which has DNS for the time server lookup, but it fails to resolve DNS, giving the error 'Failed - address not resolved'.
I've set RTCSCFG_ENABLE_LWDNS 1 in user_config.h and rebuilt MQX.
I'm sure about the DNS address (192.168.1.1) and have set up a PC on the network to have a static IP and this DNS successfully.
MQX networking is otherwise working, I can telnet in to web_hvac, for instance.
I've tried coding it myself too, using the RTCS user guide for reference: still dead.
I'm using MQX 3.6 and the TWRMCF52259.
Any idea what I might be doing wrong? I'd like to get the heads-up of the security email demo working to the point that it can resolve the time server, if possible. Does it actually work for anyone else? Anyone fancy doing a quick test?
Thanks in advance!
Joe
Solved! Go to Solution.
Further research shows that toupper and tolower are swapped in the Codewarrior header files. A fix is here:
https://community.freescale.com/thread/64812
I forgot to indicate that i am using the M52259DEMO board.
Fabio
Hi,
my first trials with DNS also went wrong. I am using MQX3.6 with CW 7.2 end tryed with RTCSCFG_ENABLE_LWDNS set to 1 and RTCSCFG_ENABLE_DNS set to 0 and derived my code form the Security_Network.c of the security_email demo.
I discovered an error in the library module resolver.c in the routine domains_equal(). There is also
also suspicious comment on the first line of the body: 'this needs to be fixed'!
This routine really doesn't work: In my trials, the 2 compared string were the same with the exception
of the dropped dots in string 'res_domain'. If in, this case, i shortcut the comparison and force a TRUE return
value the query to the DNS server completes succesfully (the IP address is already known at this point)
with the correct ip address.
The same problem seems to be already present in MQX3.1.
Is this not a bug to be fixed by Freescale?
Fabio
Hello,
the routine compares dotted domain name (string) with domain name in dns packet format (e.g. 6 forums 9 freescale 3 com 0). It seems to work ok for me.
But on the other hand, those 2 routines working with domain names do not handle compressed names properly.
So thanks for pointing this out, the fix will be available in the next release.
Regards,
PetrM
Hello,
I have found the same problem. In my case, i try to resolve "smtp.laposte.net", but the string returned is
4 smtp 10 laposte 3 net
since it would be 7 for laposte...
i'll work with the IP address hopping the problem will be fixed in the next version of MQX
Regards,
Christophe
The problem is that tolower returns the uppercase letter. I fixed it this way, and now I can resolve internet addresses with mixed case input:
line 2762 of resolver.c:
- if (req_domain[req_index++] != tolower(res_domain[res_index++])) {
+ if (tolower(req_domain[req_index++]) != tolower(res_domain[res_index++])) {
Blake
Further research shows that toupper and tolower are swapped in the Codewarrior header files. A fix is here:
https://community.freescale.com/thread/64812