Author Topic: fnDNSListner() returning an unknown errror sometimes  (Read 3876 times)

Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
fnDNSListner() returning an unknown errror sometimes
« 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: [Select]
//local dns function for nslookup via the telnet client.
static void fnDNSListner(unsigned char ucEvent, unsigned char *ptrIP){
CHAR cBuf[21];

    switch (ucEvent) {
uStrcpy(cBuf, "DNS answer: ");
//fnDebugMsg("DNS answer: ");
fnIPStr(ptrIP, cBuf);
default:// DNS error message
uStrcpy(cBuf, "DNS Error: ");
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:");
fnDebugDec(ucEvent, 0,cBuf);


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3216
    • View Profile
    • uTasker
Re: fnDNSListner() returning an unknown errror sometimes
« 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?