lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Unhandled error condition in dns_send()


From: Bjoern Doebel
Subject: [lwip-devel] Unhandled error condition in dns_send()
Date: Mon, 17 May 2010 08:34:37 +0200

Hello,

I'm working on LWIP on a local research OS and stumbled across a case
where DNS wasn't working. After some debugging I found out that I
hadn't set a default route using netif_set_default().

During debugging I found that dns_send() in src/core/dns.c may return
errors which are not checked at the function's call sites. Some
information on these errors would at least have made life easier for
me. I therefore currently have the following patch applied:

Index: src/core/dns.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/dns.c,v
retrieving revision 1.45
diff -u -r1.45 dns.c
--- src/core/dns.c      16 May 2010 15:57:44 -0000      1.45
+++ src/core/dns.c      17 May 2010 06:29:42 -0000
@@ -635,6 +635,7 @@
 static void
 dns_check_entry(u8_t i)
 {
+  int err;
   struct dns_table_entry *pEntry = &dns_table[i];

   LWIP_ASSERT("array index out of bounds", i < DNS_TABLE_SIZE);
@@ -649,7 +650,9 @@
       pEntry->retries = 0;

       /* send DNS packet for this entry */
-      dns_send(pEntry->numdns, pEntry->name, i);
+      err = dns_send(pEntry->numdns, pEntry->name, i);
+      if (err)
+        printf("Error in dns_send: %d\n", err);
       break;
     }

@@ -678,7 +681,9 @@
         pEntry->tmr = pEntry->retries;

         /* send DNS packet for this entry */
-        dns_send(pEntry->numdns, pEntry->name, i);
+        err = dns_send(pEntry->numdns, pEntry->name, i);
+        if (err)
+          printf("Error in dns_send: %d\n", err);
       }
       break;
     }


Is this reasonable or are there more useful alternatives for error reporting?

Regards,
Bjoern



reply via email to

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