lwip-commits
[Top][All Lists]
Advanced

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

[lwip-commits] lwip/src/core dhcp.c


From: Curt McDowell
Subject: [lwip-commits] lwip/src/core dhcp.c
Date: Thu, 08 Jun 2006 00:16:56 +0000

CVSROOT:        /cvsroot/lwip
Module name:    lwip
Changes by:     Curt McDowell <curtmcd> 06/06/08 00:16:56

Modified files:
        src/core       : dhcp.c 

Log message:
        Fix incorrect calculation of dhcp->dns_count.
        Comment out unused static dhcp_get_option_short() to avoid warning.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/lwip/src/core/dhcp.c?cvsroot=lwip&r1=1.55&r2=1.56

Patches:
Index: dhcp.c
===================================================================
RCS file: /cvsroot/lwip/lwip/src/core/dhcp.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- dhcp.c      25 Nov 2005 12:03:38 -0000      1.55
+++ dhcp.c      8 Jun 2006 00:16:56 -0000       1.56
@@ -107,7 +107,9 @@
 static err_t dhcp_unfold_reply(struct dhcp *dhcp);
 static u8_t *dhcp_get_option_ptr(struct dhcp *dhcp, u8_t option_type);
 static u8_t dhcp_get_option_byte(u8_t *ptr);
+#if 0
 static u16_t dhcp_get_option_short(u8_t *ptr);
+#endif
 static u32_t dhcp_get_option_long(u8_t *ptr);
 static void dhcp_free_reply(struct dhcp *dhcp);
 
@@ -490,12 +492,12 @@
   option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_DNS_SERVER);
   if (option_ptr != NULL) {
     u8_t n;
-    dhcp->dns_count = dhcp_get_option_byte(&option_ptr[1]);
+    dhcp->dns_count = dhcp_get_option_byte(&option_ptr[1]) / 
(u32_t)sizeof(struct ip_addr);
     /* limit to at most DHCP_MAX_DNS DNS servers */
-    if (dhcp->dns_count > DHCP_MAX_DNS) dhcp->dns_count = DHCP_MAX_DNS;
-    for (n = 0; n < dhcp->dns_count; n++)
-    {
-      dhcp->offered_dns_addr[n].addr = 
htonl(dhcp_get_option_long(&option_ptr[2+(n<<2)]));
+    if (dhcp->dns_count > DHCP_MAX_DNS)
+       dhcp->dns_count = DHCP_MAX_DNS;
+    for (n = 0; n < dhcp->dns_count; n++) {
+      dhcp->offered_dns_addr[n].addr = 
htonl(dhcp_get_option_long(&option_ptr[2 + n * 4]));
     }
   }
 }
@@ -1399,7 +1401,7 @@
       }
     }
   }
-  return 0;
+  return NULL;
 }
 
 /**
@@ -1416,6 +1418,7 @@
   return *ptr;
 }
 
+#if 0
 /**
  * Return the 16-bit value of DHCP option data.
  *
@@ -1432,6 +1435,7 @@
   LWIP_DEBUGF(DHCP_DEBUG, ("option short value=%"U16_F"\n", value));
   return value;
 }
+#endif
 
 /**
  * Return the 32-bit value of DHCP option data.




reply via email to

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