µTasker Forum
June 18, 2013, 08:06:08 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: March 2012: uTasker KINETIS and STM32 release versions available.
Follow uTasker updates at www.twitter.com/uTasker !!

Online Forum registration has now been disabled. Please send an email to an address at the bottom of the home page with your preferred user name and email address if you would like an account.
 
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: fnDNSListner() returning an unknown errror sometimes  (Read 300 times)
alager
Jr. Member
**
Offline Offline

Posts: 86


View Profile
« on: April 30, 2012, 07:53:08 PM »

We are starting to accumulate customer calls that turn out to be a lack of DNS resolution.  However, as shown in the function below, we are hitting the "Some Unknown Error" case, and no number is printed out.  Of course this is something that we are not able to reproduce here, so I'm looking for ideas on what sorts of things can cause this.

Code:
//local dns function for nslookup via the telnet client.
static void fnDNSListner(unsigned char ucEvent, unsigned char *ptrIP){
CHAR cBuf[21];

    switch (ucEvent) {
case DNS_EVENT_SUCCESS:
uStrcpy(cBuf, "DNS answer: ");
fnDebugMsg(cBuf);
//fnDebugMsg("DNS answer: ");
fnIPStr(ptrIP, cBuf);
break;
default:// DNS error message
uStrcpy(cBuf, "DNS Error: ");
fnDebugMsg(cBuf);
if (ucEvent == DNS_ERROR_NO_ARP_RES) {
uStrcpy(cBuf, "DNS_ERROR_NO_ARP_RES");
}else if (ucEvent == DNS_ERROR_TIMEOUT) {
uStrcpy(cBuf, "DNS_ERROR_TIMEOUT");
}else if (ucEvent == DNS_ERROR_GENERAL) {
uStrcpy(cBuf, "DNS_ERROR_GENERAL");
}else if (ucEvent == DNS_OPCODE_ERROR) {
uStrcpy(cBuf, "DNS_OPCODE_ERROR");
} else {
uStrcpy(cBuf, "Some Unknown Error:");
fnDebugMsg(cBuf);
fnDebugDec(ucEvent, 0,cBuf);
}
break;
    }
fnDebugMsg(cBuf);
fnDebugMsg("\r\n");
}


Thanks,
Aaron
Logged
mark
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2479



View Profile WWW
« Reply #1 on: April 30, 2012, 10:49:00 PM »

Hi Aaron

Your error handler is catching all possible events as far as I can see.
Why doesn't the value of ucEvent get printed out? The code looks to be preparing its decimal value in cBuf so it should display it along with the "DNS Error: Some Unknown Error:"
Is it possible that you have a very small (debug) output buffer that doesn't have space in it for the end of the message?

Since I don't found any code location calling the DNS callback with an unexpected value I can only imagine that the passed value (ucEvent) is somehow getting manipulated between the call and the error output.
What happens if you force an error like DNS_ERROR_NO_ARP_RES by disconnecting its gateway? Does it then display the correct error?

Regards

Mark
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Copyright © 2013 utasker.com. Webdesign and Hosting by e-future.ch 2013
Valid XHTML 1.0! Valid CSS!
Page created in 0.046 seconds with 19 queries.