diff --git a/ChangeLog b/ChangeLog
index fc5cfa4437a234cf5095598b30e0846dda178f38..1cfdfbb39af4402e7fbc6aaaf589cbfa35116fd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -259,3 +259,5 @@
 	  and polling intervals.  Greatly improves send performance.
 
 0.3.4 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+
+	* Added netutils/dhcpd
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index 4255dd17a46ce1b85d342b3241662bffe1f1e260..20a4a29eb87d8924beed0c7235b3ea4ff0d3ddd5 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -747,6 +747,8 @@ Other memory:
 
 <pre><ul>
 0.3.4 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+
+	* Added netutils/dhcpd
 </pre></ul>
 
 <table width ="100%">
diff --git a/TODO b/TODO
index c0aff5318e78e3c60d6a14e777efb4f5d95924f0..500013d146fa78c31050f417e8f082f50d88c5a0 100644
--- a/TODO
+++ b/TODO
@@ -70,14 +70,19 @@ o Build system
 
 o Applications & Tests
 
-o C5471
+o ARM
+- Add option to use a separate stack for interrupt handling.  At present,
+  each interrupt executes on top of the user stack allocation making each
+  user stack allocation larger than needed.
 
-o DM320
+o ARM/C5471
+
+o ARM/DM320
 - It seems that when a lot of debug statements are added, the system no
   longer boots.  This has been diagnosed as a stack problem.. making the stack
   bigger or removing arrays on the stack fixes the problem.
 
-o LPC214x
+o ARM/LPC214x
 - Finish bringup
 - Add MMC and USB support
 
diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c
index b6d932cb97eab955e6c80ddd76c74f3da4d8eb0b..2a63d7383671358f8b9a2b698905b752c1ad4f70 100644
--- a/drivers/net/dm90x0.c
+++ b/drivers/net/dm90x0.c
@@ -294,6 +294,7 @@ union rx_desc_u
 
 struct dm9x_driver_s
 {
+  boolean dm_bifup;            /* TRUE:ifup FALSE:ifdown */
   boolean dm_b100M;            /* TRUE:speed == 100M; FALSE:speed == 10M */
   WDOG_ID dm_txpoll;           /* TX poll timer */
   WDOG_ID dm_txtimeout;        /* TX timeout timer */
@@ -1396,6 +1397,7 @@ static int dm9x_ifup(struct uip_driver_s *dev)
 
   /* Enable the DM9X interrupt */
 
+  dm9x->dm_bifup = TRUE;
   up_enable_irq(CONFIG_DM9X_IRQ);
   return OK;
 }
@@ -1440,6 +1442,8 @@ static int dm9x_ifdown(struct uip_driver_s *dev)
   putreg(DM9X_IMR, DM9X_IMRDISABLE);  /* Disable all interrupts */
   putreg(DM9X_RXC, 0x00);             /* Disable RX */
   putreg(DM9X_ISR, DM9X_INT_ALL);     /* Clear interrupt status */
+
+  dm9x->dm_bifup = FALSE;
   irqrestore(flags);
 
   /* Dump statistics */
@@ -1475,15 +1479,21 @@ static int dm9x_txavail(struct uip_driver_s *dev)
   ndbg("Polling\n");
   flags = irqsave();
 
-  /* Check if there is room in the DM90x0 to hold another packet.  In 100M mode,
-   * that can be 2 packets, otherwise it is a single packet.
-   */
+  /* Ignore the notification if the interface is not yet up */
 
-  if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2))
+  if (dm9x->dm_bifup)
     {
-      /* If so, then poll uIP for new XMIT data */
 
-      (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll);
+      /* Check if there is room in the DM90x0 to hold another packet.  In 100M
+       * mode, that can be 2 packets, otherwise it is a single packet.
+       */
+
+      if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2))
+        {
+          /* If so, then poll uIP for new XMIT data */
+
+          (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll);
+        }
     }
   irqrestore(flags);
   return OK;
diff --git a/examples/uip/main.c b/examples/uip/main.c
index 83da6fe2c9eaf55512cb840c38bfa1dafc48000a..a5640f848c9e73cbab2b492c764adecb73548225 100644
--- a/examples/uip/main.c
+++ b/examples/uip/main.c
@@ -51,6 +51,7 @@
 #include <time.h>
 #include <debug.h>
 
+#include <net/if.h>
 #include <net/uip/uip.h>
 #include <net/uip/uip-arp.h>
 #include <net/uip/uip-lib.h>
@@ -85,6 +86,12 @@
  * Definitions
  ****************************************************************************/
 
+#ifdef CONFIG_DEBUG
+#  define message(...) lib_lowprintf(__VA_ARGS__)
+#else
+#  define message(...) printf(__VA_ARGS__)
+#endif
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -120,9 +127,7 @@ void user_initialize(void)
 
 int user_start(int argc, char *argv[])
 {
-#if !defined(CONFIG_EXAMPLE_UIP_DHCPC)
   struct in_addr addr;
-#endif
 #if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC)
   uint8 mac[IFHWADDRLEN];
 #endif
@@ -142,10 +147,13 @@ int user_start(int argc, char *argv[])
   uip_setmacaddr("eth0", mac);
 #endif
 
-#if !defined(CONFIG_EXAMPLE_UIP_DHCPC)
   /* Set up our host address */
 
+#if !defined(CONFIG_EXAMPLE_UIP_DHCPC)
   addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_IPADDR);
+#else
+  addr.s_addr = 0;
+#endif
   uip_sethostaddr("eth0", &addr);
 
   /* Set up the default router address */
@@ -157,7 +165,6 @@ int user_start(int argc, char *argv[])
 
   addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_NETMASK);
   uip_setnetmask("eth0", &addr);
-#endif
 
 #if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_WEBCLIENT)
   /* Set up the resolver */
diff --git a/fs/fs_ioctl.c b/fs/fs_ioctl.c
index 52329d60c62014b53806ef38859d05d27cf0e429..ba81228c1bbb65f6180b9556e0ccb297c8bb22cb 100644
--- a/fs/fs_ioctl.c
+++ b/fs/fs_ioctl.c
@@ -43,9 +43,12 @@
 
 #include <nuttx/config.h>
 #include <sys/types.h>
+#include <sys/ioctl.h>
+
 #include <sched.h>
 #include <errno.h>
-#include <sys/ioctl.h>
+
+#include <net/if.h>
 
 #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
 # include <nuttx/net.h>
diff --git a/include/net/if.h b/include/net/if.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d8ea6007935aaa626d235fb38a1a7c7be9a940f
--- /dev/null
+++ b/include/net/if.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * net/if.h
+ *
+ *   Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ *    used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __NET_IF_H
+#define __NET_IF_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/socket.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Sizing parameters */
+
+#define IFNAMSIZ        6
+#define IFHWADDRLEN     6
+
+/****************************************************************************
+ * Type Definitions
+ ****************************************************************************/
+
+struct ifreq
+{
+  char       ifr_name[IFNAMSIZ];      /* Network device name (e.g. "eth0") */
+  union
+  {
+    struct sockaddr ifru_addr;        /* IP Address */
+    struct sockaddr ifru_dstaddr;     /* P-to-P Address */
+    struct sockaddr ifru_broadaddr;   /* Broadcast address */
+    struct sockaddr ifru_netmask;     /* Netmask */
+    struct sockaddr ifru_hwaddr;      /* MAC address */
+    int     ifru_count;               /* Number of devices */
+    int     ifru_mtu;                 /* MTU size */
+  } ifr_ifru;
+};
+
+#define ifr_addr        ifr_ifru.ifru_addr      /* IP address */
+#define ifr_dstaddr     ifr_ifru.ifru_dstaddr   /* P-to-P Address */
+#define ifr_broadaddr   ifr_ifru.ifru_broadaddr /* Broadcast address */
+#define ifr_netmask     ifr_ifru.ifru_netmask   /* Interface net mask */
+#define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address */
+#define ifr_mtu         ifr_ifru.ifru_mtu       /* MTU */
+#define ifr_count       ifr_ifru.ifru_count     /* Number of devices */
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#endif /* __NET_IF_H */
diff --git a/include/net/ioctls.h b/include/net/ioctls.h
index 4be5727ac209bbc436eba36456751adb01742556..785c7d4f250b9848319a914d57e7f1a859e69033 100644
--- a/include/net/ioctls.h
+++ b/include/net/ioctls.h
@@ -40,8 +40,6 @@
  * Included Files
  ****************************************************************************/
 
-#include <sys/socket.h>
-
 /****************************************************************************
  * Definitions
  ****************************************************************************/
@@ -69,38 +67,10 @@
 #define SIOCDIFADDR     (_SIOCBASE|0x000c)  /* Delete IP address */
 #define SIOCGIFCOUNT    (_SIOCBASE|0x000d)  /* Get number of devices */
 
-/* Sizing parameters */
-
-#define IFNAMSIZ        6
-#define IFHWADDRLEN     6
-
 /****************************************************************************
  * Type Definitions
  ****************************************************************************/
 
-struct ifreq
-{
-  char       ifr_name[IFNAMSIZ];      /* Network device name (e.g. "eth0") */
-  union
-  {
-    struct sockaddr ifru_addr;        /* IP Address */
-    struct sockaddr ifru_dstaddr;     /* P-to-P Address */
-    struct sockaddr ifru_broadaddr;   /* Broadcast address */
-    struct sockaddr ifru_netmask;     /* Netmask */
-    struct sockaddr ifru_hwaddr;      /* MAC address */
-    int     ifru_count;               /* Number of devices */
-    int     ifru_mtu;                 /* MTU size */
-  } ifr_ifru;
-};
-
-#define ifr_addr        ifr_ifru.ifru_addr      /* IP address */
-#define ifr_dstaddr     ifr_ifru.ifru_dstaddr   /* P-to-P Address */
-#define ifr_broadaddr   ifr_ifru.ifru_broadaddr /* Broadcast address */
-#define ifr_netmask     ifr_ifru.ifru_netmask   /* Interface net mask */
-#define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address */
-#define ifr_mtu         ifr_ifru.ifru_mtu       /* MTU */
-#define ifr_count       ifr_ifru.ifru_count     /* Number of devices */
-
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
diff --git a/include/net/uip/dhcpc.h b/include/net/uip/dhcpc.h
index 12f3f0a9bb3652e19afd4d17e6bb68c628376bfb..606d818b0cbc7075067fb2d3fe273646b450d717 100644
--- a/include/net/uip/dhcpc.h
+++ b/include/net/uip/dhcpc.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * dhcpc.c
+ * net/uip/dhcpc.n
  *
  *   Copyright (C) 2007 Gregory Nutt. All rights reserved.
  *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -35,8 +35,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef NET_UIP_DHCP_H__
-#define NET_UIP_DHCP_H__
+#ifndef __NET_UIP_DHCPC_H
+#define __NET_UIP_DHCPC_H
 
 /****************************************************************************
  * Included Files
@@ -66,8 +66,20 @@ struct dhcpc_state
  * Public Function Prototypes
  ****************************************************************************/
 
-void *dhcpc_open(const void *mac_addr, int mac_len);
-int   dhcpc_request(void *handle, struct dhcpc_state *presult);
-void  dhcpc_close(void *handle);
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
 
-#endif /* NET_UIP_DHCP_H__ */
+EXTERN void *dhcpc_open(const void *mac_addr, int mac_len);
+EXTERN int   dhcpc_request(void *handle, struct dhcpc_state *presult);
+EXTERN void  dhcpc_close(void *handle);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NET_UIP_DHCPC_H */
diff --git a/include/net/uip/dhcpd.h b/include/net/uip/dhcpd.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed8770f0346b46e667e1b5f80598a936678ae952
--- /dev/null
+++ b/include/net/uip/dhcpd.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * net/uipt/dhcpd.h
+ *
+ *   Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * This logic was leveraged from uIP which also has a BSD-style license:
+ *
+ *   Copyright (c) 2005, Swedish Institute of Computer Science
+ *   All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __NET_UIP_DHCPD_H
+#define __NET_UIP_DHCPD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+EXTERN int dhcpd_run(void);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NET_UIP_DHCPD_H */
diff --git a/include/net/uip/uip-arch.h b/include/net/uip/uip-arch.h
index eb5a0e5ba275dfcbed6d38b26a8bfa49916258ce..9de911e00c5031f976ded4b7deede1663af4be3e 100644
--- a/include/net/uip/uip-arch.h
+++ b/include/net/uip/uip-arch.h
@@ -45,6 +45,7 @@
 #include <nuttx/config.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
+#include <net/if.h>
 #include <net/uip/uip.h>
 
 /****************************************************************************
diff --git a/net/netdev-ioctl.c b/net/netdev-ioctl.c
index 9adc2ae0ae47d3994df8a4420465d7434264a7e7..81cfce689c6237845d155d8de85b78fa9fe44454 100644
--- a/net/netdev-ioctl.c
+++ b/net/netdev-ioctl.c
@@ -50,6 +50,7 @@
 
 #include <nuttx/net.h>
 
+#include <net/if.h>
 #include <net/uip/uip-arch.h>
 #include <net/uip/uip.h>
 
diff --git a/net/netdev-register.c b/net/netdev-register.c
index 03a978880872d42a54173e1af349cb116545bacf..b1ab57a44fea871575ac8a1526cc4d6d918845a8 100644
--- a/net/netdev-register.c
+++ b/net/netdev-register.c
@@ -49,6 +49,7 @@
 #include <errno.h>
 #include <debug.h>
 
+#include <net/if.h>
 #include <net/uip/uip-arch.h>
 
 #include "net-internal.h"
diff --git a/net/sendto.c b/net/sendto.c
index a0f3cc4a10772b525d75cbbd8e1000ed86ac646b..0e5b80032f49da5562ff6ce9a2612e81f86416a8 100644
--- a/net/sendto.c
+++ b/net/sendto.c
@@ -44,6 +44,7 @@
 #include <sys/socket.h>
 #include <string.h>
 #include <errno.h>
+#include <debug.h>
 #include <arch/irq.h>
 #include <net/uip/uip-arch.h>
 
@@ -93,6 +94,8 @@ struct sendto_s
 void sendto_interrupt(struct uip_driver_s *dev, struct uip_udp_conn *conn, uint8 flags)
 {
   struct sendto_s *pstate = (struct sendto_s *)conn->private;
+
+  nvdbg("flags: %02x\n");
   if (pstate)
     {
       /* Check if the connection was rejected */
diff --git a/net/uip/uip-arp.c b/net/uip/uip-arp.c
index 59558072beb3c7eb291b5b871fdbacbd9cb4eaee..838d99b72c37348e520773d53e4a780a5b7253dd 100644
--- a/net/uip/uip-arp.c
+++ b/net/uip/uip-arp.c
@@ -62,6 +62,7 @@
 #include <debug.h>
 
 #include <netinet/in.h>
+#include <net/if.h>
 #include <net/uip/uip-arch.h>
 #include <net/uip/uip-arp.h>
 
diff --git a/net/uip/uip-icmpinput.c b/net/uip/uip-icmpinput.c
index 2f14945b78b764df429fdd97042d280890101e76..747301f2b91bc9ab0ca9b3bd0f8a6d9e8aa06668 100644
--- a/net/uip/uip-icmpinput.c
+++ b/net/uip/uip-icmpinput.c
@@ -48,6 +48,7 @@
 #include <sys/types.h>
 #include <debug.h>
 
+#include <net/if.h>
 #include <net/uip/uipopt.h>
 #include <net/uip/uip.h>
 #include <net/uip/uip-arch.h>
diff --git a/net/uip/uip-send.c b/net/uip/uip-send.c
index c9899db9e38d81f7842172688cf1f364e190ab3f..6e83cb0d83bdcf7a48f3f4fc0f23aed413112f71 100644
--- a/net/uip/uip-send.c
+++ b/net/uip/uip-send.c
@@ -42,6 +42,7 @@
  ****************************************************************************/
 
 #include <string.h>
+#include <debug.h>
 
 #include <net/uip/uip.h>
 #include <net/uip/uip-arch.h>
diff --git a/netutils/Makefile b/netutils/Makefile
index 752a6d0b130fb379325f31a782212ae715f6609a..0c14a109455d6b128f39951caedcb09698799c09 100644
--- a/netutils/Makefile
+++ b/netutils/Makefile
@@ -47,16 +47,17 @@ include webserver/Make.defs
 endif
 ifeq ($(CONFIG_NET_UDP),y)
 include dhcpc/Make.defs
+include dhcpd/Make.defs
 include resolv/Make.defs
 endif
 endif
 
-ASRCS		= $(UIPLIB_ASRCS) $(DHCPC_ASRCS) $(RESOLV_ASRCS) $(SMTP_ASRCS) \
-		  $(TELNETD_ASRCS) $(WEBCLIENT_ASRCS) $(WEBSERVER_ASRCS) $(STRNG_ASRCS)
+ASRCS		= $(UIPLIB_ASRCS) $(DHCPC_ASRCS) $(DHCPD_ASRCS) $(RESOLV_ASRCS) \
+		  $(SMTP_ASRCS) $(TELNETD_ASRCS) $(WEBCLIENT_ASRCS) $(WEBSERVER_ASRCS)
 AOBJS		= $(ASRCS:.S=$(OBJEXT))
 
-CSRCS		= $(UIPLIB_CSRCS) $(DHCPC_CSRCS) $(RESOLV_CSRCS) $(SMTP_CSRCS) \
-		  $(TELNETD_CSRCS) $(WEBCLIENT_CSRCS) $(WEBSERVER_CSRCS) $(STRNG_CSRCS)
+CSRCS		= $(UIPLIB_CSRCS) $(DHCPC_CSRCS) $(DHCPD_CSRCS) $(RESOLV_CSRCS) \
+		  $(SMTP_CSRCS) $(TELNETD_CSRCS) $(WEBCLIENT_CSRCS) $(WEBSERVER_CSRCS)
 COBJS		= $(CSRCS:.c=$(OBJEXT))
 
 SRCS		= $(ASRCS) $(CSRCS)
@@ -64,7 +65,7 @@ OBJS		= $(AOBJS) $(COBJS)
 
 BIN		= libnetutils$(LIBEXT)
 
-VPATH		= uiplib:dhcpc:resolv:smtp:telnetd:webclient:webserver
+VPATH		= uiplib:dhcpc:dhcpd:resolv:smtp:telnetd:webclient:webserver
 
 all:	$(BIN)
 
@@ -82,8 +83,9 @@ $(BIN): $(OBJS)
 
 .depend: Makefile $(SRCS)
 ifeq ($(CONFIG_NET),y)
-	@$(MKDEP) --dep-path . --dep-path uiplib --dep-path dhcpc --dep-path smtp --dep-path webclient \
-		 --dep-path resolv --dep-path telnetd --dep-path webserver \
+	@$(MKDEP) --dep-path . --dep-path uiplib --dep-path dhcpc --dep-path dhcpd \
+		  --dep-path smtp --dep-path webclient --dep-path resolv \
+		  --dep-path telnetd --dep-path webserver \
 	$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
 endif
 	@touch $@
@@ -92,11 +94,11 @@ depend: .depend
 
 clean:
 	@rm -f $(BIN) *.o *.rel *.asm *.lst *.sym *.adb *~
-	@rm -f uiplib/*~ dhcpc/*~ resolv/*~ smtp/*~ telnetd/*~ webclient/*~ webserver/*~
+	@rm -f uiplib/*~ dhcpc/*~ dhcpd/*~ resolv/*~ smtp/*~ telnetd/*~ webclient/*~ webserver/*~
 	@if [ ! -z "$(OBJEXT)" ]; then rm -f *$(OBJEXT); fi
+	@$(MAKE) -C dhcpd -f Makefile.host clean
 
 distclean: clean
 	@rm -f Make.dep .depend
-	@rm -f $(STRNG_CSRCS) $(STRNG_ASRCS)
 
 -include Make.dep
diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c
index bdb885ccce22dd5e91be465e3fb86325a41e0dc6..6b7bc9535a9222fa313e310d0265fd24b5d58dbd 100644
--- a/netutils/dhcpc/dhcpc.c
+++ b/netutils/dhcpc/dhcpc.c
@@ -100,15 +100,6 @@
  * Private Types
  ****************************************************************************/
 
-struct dhcpc_state_internal
-{
-  struct uip_udp_conn *conn;
-  const void          *mac_addr;
-  int                  mac_len;
-  int                  sockfd;
-  char                 buffer[256];
-};
-
 struct dhcp_msg
 {
   uint8  op;
@@ -130,6 +121,15 @@ struct dhcp_msg
   uint8  options[312];
 };
 
+struct dhcpc_state_s
+{
+  struct uip_udp_conn *ds_conn;
+  const void          *ds_macaddr;
+  int                  ds_maclen;
+  int                  sockfd;
+  struct dhcp_msg      packet;
+};
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -181,74 +181,66 @@ static uint8 *add_end(uint8 *optptr)
   return optptr;
 }
 
-static void create_msg(struct dhcpc_state_internal *pdhcpc, struct dhcp_msg *pmsg)
+static void create_msg(struct dhcpc_state_s *pdhcpc)
 {
   struct in_addr addr;
 
-  pmsg->op    = DHCP_REQUEST;
-  pmsg->htype = DHCP_HTYPE_ETHERNET;
-  pmsg->hlen  = pdhcpc->mac_len;
-  pmsg->hops  = 0;
-  memcpy(pmsg->xid, xid, sizeof(pmsg->xid));
-  pmsg->secs  = 0;
-  pmsg->flags = HTONS(BOOTP_BROADCAST); /*  Broadcast bit. */
+  memset(&pdhcpc->packet, 0, sizeof(struct dhcp_msg));
+  pdhcpc->packet.op    = DHCP_REQUEST;
+  pdhcpc->packet.htype = DHCP_HTYPE_ETHERNET;
+  pdhcpc->packet.hlen  = pdhcpc->ds_maclen;
+  memcpy(pdhcpc->packet.xid, xid, 4);
+  pdhcpc->packet.flags = HTONS(BOOTP_BROADCAST); /*  Broadcast bit. */
 
   uip_gethostaddr("eth0", &addr);
-  memcpy(&pmsg->ciaddr, &addr.s_addr, sizeof(pmsg->ciaddr));
-  memset(pmsg->yiaddr, 0, sizeof(pmsg->yiaddr));
-  memset(pmsg->siaddr, 0, sizeof(pmsg->siaddr));
-  memset(pmsg->giaddr, 0, sizeof(pmsg->giaddr));
-
-  memcpy(pmsg->chaddr, pdhcpc->mac_addr, pdhcpc->mac_len);
-  memset(&pmsg->chaddr[pdhcpc->mac_len], 0, sizeof(pmsg->chaddr) - pdhcpc->mac_len);
-#ifndef CONFIG_NET_DHCP_LIGHT
-  memset(pmsg->sname, 0, sizeof(pmsg->sname));
-  memset(pmsg->file, 0, sizeof(pmsg->file));
-#endif
+  memcpy(&pdhcpc->packet.ciaddr, &addr.s_addr, 4);
 
-  memcpy(pmsg->options, magic_cookie, sizeof(magic_cookie));
+  memcpy(pdhcpc->packet.chaddr, pdhcpc->ds_macaddr, pdhcpc->ds_maclen);
+  memset(&pdhcpc->packet.chaddr[pdhcpc->ds_maclen], 0, 16 - pdhcpc->ds_maclen);
+  memcpy(pdhcpc->packet.options, magic_cookie, sizeof(magic_cookie));
 }
 
-static int send_discover(struct dhcpc_state_internal *pdhcpc)
+static int send_discover(struct dhcpc_state_s *pdhcpc)
 {
-  struct dhcp_msg msg;
   struct sockaddr_in addr;
   uint8 *pend;
   int len;
 
-  create_msg(pdhcpc, &msg);
-  pend = add_msg_type(&msg.options[4], DHCPDISCOVER);
+dbg("Calling create_msg\n");
+  create_msg(pdhcpc);
+  pend = &pdhcpc->packet.options[4];
+  pend = add_msg_type(pend, DHCPDISCOVER);
   pend = add_req_options(pend);
   pend = add_end(pend);
-  len  = pend - (uint8*)&msg;
+  len  = pend - (uint8*)&pdhcpc->packet;
 
   addr.sin_family      = AF_INET;
   addr.sin_port        = HTONS(DHCPC_SERVER_PORT);
   addr.sin_addr.s_addr = INADDR_BROADCAST;
 
-  return sendto(pdhcpc->sockfd, &msg, len, 0,
+dbg("Calling sendto, len=%d\n", len);
+  return sendto(pdhcpc->sockfd, &pdhcpc->packet, len, 0,
                 (struct sockaddr*)&addr, sizeof(struct sockaddr_in));
 }
-
-static int send_request(struct dhcpc_state_internal *pdhcpc, struct dhcpc_state *presult)
+static int send_request(struct dhcpc_state_s *pdhcpc, struct dhcpc_state *presult)
 {
-  struct dhcp_msg msg;
   struct sockaddr_in addr;
   uint8 *pend;
   int len;
 
-  create_msg(pdhcpc, &msg);
-  pend = add_msg_type(&msg.options[4], DHCPREQUEST);
+  create_msg(pdhcpc);
+  pend = &pdhcpc->packet.options[4];
+  pend = add_msg_type(pend, DHCPREQUEST);
   pend = add_server_id(presult, pend);
   pend = add_req_ipaddr(presult, pend);
   pend = add_end(pend);
-  len  = pend - (uint8*)&msg;
+  len  = pend - (uint8*)&pdhcpc->packet;
 
   addr.sin_family      = AF_INET;
   addr.sin_port        = HTONS(DHCPC_SERVER_PORT);
   addr.sin_addr.s_addr = INADDR_BROADCAST;
 
-  return sendto(pdhcpc->sockfd, &msg, len, 0,
+  return sendto(pdhcpc->sockfd, &pdhcpc->packet, len, 0,
                 (struct sockaddr*)&addr, sizeof(struct sockaddr_in));
 }
 
@@ -288,16 +280,15 @@ static uint8 parse_options(struct dhcpc_state *presult, uint8 *optptr, int len)
   return type;
 }
 
-static uint8 parse_msg(struct dhcpc_state_internal *pdhcpc, int buflen, struct dhcpc_state *presult)
+static uint8 parse_msg(struct dhcpc_state_s *pdhcpc, int buflen,
+                       struct dhcpc_state *presult)
 {
-  struct dhcp_msg *pbuffer = (struct dhcp_msg *)pdhcpc->buffer;
-
-  if (pbuffer->op == DHCP_REPLY &&
-      memcmp(pbuffer->xid, xid, sizeof(xid)) == 0 &&
-      memcmp(pbuffer->chaddr, pdhcpc->mac_addr, pdhcpc->mac_len) == 0)
+  if (pdhcpc->packet.op == DHCP_REPLY &&
+      memcmp(pdhcpc->packet.xid, xid, sizeof(xid)) == 0 &&
+      memcmp(pdhcpc->packet.chaddr, pdhcpc->ds_macaddr, pdhcpc->ds_maclen) == 0)
     {
-      memcpy(&presult->ipaddr.s_addr, pbuffer->yiaddr, 4);
-      return parse_options(presult, &pbuffer->options[4], buflen);
+      memcpy(&presult->ipaddr.s_addr, pdhcpc->packet.yiaddr, 4);
+      return parse_options(presult, &pdhcpc->packet.options[4], buflen);
     }
   return 0;
 }
@@ -306,22 +297,22 @@ static uint8 parse_msg(struct dhcpc_state_internal *pdhcpc, int buflen, struct d
  * Global Functions
  ****************************************************************************/
 
-void *dhcpc_open(const void *mac_addr, int mac_len)
+void *dhcpc_open(const void *macaddr, int maclen)
 {
-  struct dhcpc_state_internal *pdhcpc;
+  struct dhcpc_state_s *pdhcpc;
   struct sockaddr_in addr;
   struct timeval tv;
 
   /* Allocate an internal DHCP structure */
 
-  pdhcpc = (struct dhcpc_state_internal *)malloc(sizeof(struct dhcpc_state_internal));
+  pdhcpc = (struct dhcpc_state_s *)malloc(sizeof(struct dhcpc_state_s));
   if (pdhcpc)
     {
       /* Initialize the allocated structure */
 
-      memset(pdhcpc, 0, sizeof(struct dhcpc_state_internal));
-      pdhcpc->mac_addr = mac_addr;
-      pdhcpc->mac_len  = mac_len;
+      memset(pdhcpc, 0, sizeof(struct dhcpc_state_s));
+      pdhcpc->ds_macaddr = macaddr;
+      pdhcpc->ds_maclen  = maclen;
 
       /* Create a UDP socket */
 
@@ -357,6 +348,7 @@ void *dhcpc_open(const void *mac_addr, int mac_len)
         }
     }
 
+  dbg("Return %p\n", pdhcpc);
   return (void*)pdhcpc;
 }
 
@@ -371,12 +363,13 @@ void dhcpc_close(void *handle)
 
 int dhcpc_request(void *handle, struct dhcpc_state *presult)
 {
-  struct dhcpc_state_internal *pdhcpc = (struct dhcpc_state_internal *)handle;
+  struct dhcpc_state_s *pdhcpc = (struct dhcpc_state_s *)handle;
   ssize_t result;
   int state;
 
   /* Loop until we receive the offer */
 
+  dbg("Handle %p\n", handle);
   do
     {
       state = STATE_SENDING;
@@ -385,18 +378,22 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
         {
           /* Send the command */
 
+          dbg("Send DHCPDISCOVER, @4=%08x\n", *(uint32*)4);
           if (send_discover(pdhcpc) < 0)
             {
               return ERROR;
             }
 
           /* Get the response */
-
-          result = recv(pdhcpc->sockfd, pdhcpc->buffer, BUFFER_SIZE, 0);
+dbg("Sent DHCPDISCOVER\n");
+          result = recv(pdhcpc->sockfd, &pdhcpc->packet, sizeof(struct dhcp_msg), 0);
+dbg("recv returned %d\n");
           if (result >= 0)
             {
+dbg("Calling parse_msg\n");
               if (parse_msg(pdhcpc, result, presult) == DHCPOFFER)
                 {
+                  dbg("Received DHCPOFFER\n");
                   state = STATE_OFFER_RECEIVED;
                 }
             }
@@ -413,6 +410,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
         {
           /* Send the request */
 
+          dbg("Send DHCPREQUEST\n");
           if (send_request(pdhcpc, presult) < 0)
             {
               return ERROR;
@@ -420,11 +418,12 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
 
           /* Get the response */
 
-          result = recv(pdhcpc->sockfd, pdhcpc->buffer, BUFFER_SIZE, 0);
+          result = recv(pdhcpc->sockfd, &pdhcpc->packet, sizeof(struct dhcp_msg), 0);
           if (result >= 0)
             {
               if (parse_msg(pdhcpc, result, presult) == DHCPACK)
                 {
+                  dbg("Received ACK\n");
                   state = STATE_CONFIG_RECEIVED;
                 }
             }
diff --git a/netutils/uiplib/uip-gethostaddr.c b/netutils/uiplib/uip-gethostaddr.c
index 732721b10153ec8d1662adf4904ca2e31339b1a0..d20344d8cdabb17a57e55d72772f4e3a1f9ca4f5 100644
--- a/netutils/uiplib/uip-gethostaddr.c
+++ b/netutils/uiplib/uip-gethostaddr.c
@@ -43,9 +43,12 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+
 #include <string.h>
 #include <errno.h>
+
 #include <netinet/in.h>
+#include <net/if.h>
 
 #include <net/uip/uip-lib.h>
 
diff --git a/netutils/uiplib/uip-getmacaddr.c b/netutils/uiplib/uip-getmacaddr.c
index 9e7a368ab419d12ec94c133095eae821a58db0ae..c45072c86bdb97fec2c08931f78042eb6d00dddf 100644
--- a/netutils/uiplib/uip-getmacaddr.c
+++ b/netutils/uiplib/uip-getmacaddr.c
@@ -43,9 +43,12 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+
 #include <string.h>
 #include <errno.h>
+
 #include <netinet/in.h>
+#include <net/if.h>
 
 #include <net/uip/uip-lib.h>
 
diff --git a/netutils/uiplib/uip-setdraddr.c b/netutils/uiplib/uip-setdraddr.c
index e8ab142ec5da2829077685a033d55ad840321926..6d61f2d5d06fe33c597096904c9cf594c9a86b78 100644
--- a/netutils/uiplib/uip-setdraddr.c
+++ b/netutils/uiplib/uip-setdraddr.c
@@ -43,10 +43,13 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
+
 #include <netinet/in.h>
+#include <net/if.h>
 
 #include <net/uip/uip-lib.h>
 
diff --git a/netutils/uiplib/uip-sethostaddr.c b/netutils/uiplib/uip-sethostaddr.c
index 6247184ba6b34ca1ebc782c7d3c004f3a14c4bcf..3f3cd7a6d510aa9913a746ae7a6794964d84bf31 100644
--- a/netutils/uiplib/uip-sethostaddr.c
+++ b/netutils/uiplib/uip-sethostaddr.c
@@ -43,10 +43,13 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
+
 #include <netinet/in.h>
+#include <net/if.h>
 
 #include <net/uip/uip-lib.h>
 
diff --git a/netutils/uiplib/uip-setmacaddr.c b/netutils/uiplib/uip-setmacaddr.c
index 4b1e675300f95288748c6fd0d6a3ea722564f4e7..969238362d77538171ba17a312aa55008101bf5d 100644
--- a/netutils/uiplib/uip-setmacaddr.c
+++ b/netutils/uiplib/uip-setmacaddr.c
@@ -43,10 +43,13 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
+
 #include <netinet/in.h>
+#include <net/if.h>
 
 #include <net/uip/uip-lib.h>
 
diff --git a/netutils/uiplib/uip-setnetmask.c b/netutils/uiplib/uip-setnetmask.c
index ff70e5a376e02cec206733e2cfb6eed63664a410..619a5e8fa2424445df5ca2ce724a4b2f81c95ba0 100644
--- a/netutils/uiplib/uip-setnetmask.c
+++ b/netutils/uiplib/uip-setnetmask.c
@@ -43,10 +43,13 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
+
 #include <netinet/in.h>
+#include <net/if.h>
 
 #include <net/uip/uip-lib.h>