diff --git a/uip/uip-conf.h b/uip/uip-conf.h index 08f7439..8cc73a0 100644 --- a/uip/uip-conf.h +++ b/uip/uip-conf.h @@ -129,14 +129,14 @@ typedef unsigned short uip_stats_t; * * \hideinitializer */ -#define UIP_CONF_UDP 0 +#define UIP_CONF_UDP 1 /** * UDP checksums on or off * * \hideinitializer */ -#define UIP_CONF_UDP_CHECKSUMS 1 +#define UIP_CONF_UDP_CHECKSUMS 0 /** * uIP statistics on or off @@ -149,6 +149,7 @@ typedef unsigned short uip_stats_t; our project. */ /*#include "smtp.h"*/ #include "httpd.h" +#include "dhcp.h" /*#include "telnetd.h"*/ /*#include "webserver.h" */ /*#include "dhcpc.h"*/ diff --git a/uip/uip.c b/uip/uip.c index 489f221..f2d6767 100644 --- a/uip/uip.c +++ b/uip/uip.c @@ -85,6 +85,7 @@ #include "uip.h" #include "uipopt.h" #include "uip_arch.h" +#include #pragma codeseg BANK1 #pragma constseg BANK1 @@ -168,8 +169,8 @@ __xdata u16_t uip_listenports[UIP_LISTENPORTS]; /* The uip_listenports list all currently listning ports. */ #if UIP_UDP -struct uip_udp_conn *uip_udp_conn; -struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; +__xdata struct uip_udp_conn *uip_udp_conn; +__xdata struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; #endif /* UIP_UDP */ __xdata static u16_t ipid; /* Ths ipid variable is an increasing @@ -469,7 +470,7 @@ uip_connect(register __xdata uip_ipaddr_t *ripaddr, __xdata u16_t rport) __banke struct uip_udp_conn * uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport) __banked { - register struct uip_udp_conn *conn; + __xdata struct uip_udp_conn *conn; /* Find an unused local port. */ again: @@ -721,7 +722,6 @@ uip_process(u8_t flag) __banked /* Reset the length variables. */ uip_len = 0; uip_slen = 0; - /* Check if the connection is in a state in which we simply wait for the connection to time out. If so, we increase the connection's timer and remove the connection if it times @@ -919,12 +919,14 @@ uip_process(u8_t flag) __banked } #endif /* UIP_BROADCAST */ - /* Check if the packet is destined for our IP address. */ + /* Check if we have a DHCP packet, otherwise check if the packet is destined for our IP address. */ #if !UIP_CONF_IPV6 - if(!uip_ipaddr_cmpx(BUF->destipaddr, uip_hostaddr)) { - UIP_STAT(++uip_stat.ip.drop); - goto drop; - } + if(!(BUF->proto == UIP_PROTO_UDP && UDPBUF->destport == HTONS(DHCPC_CLIENT_PORT))) { + if(!uip_ipaddr_cmpx(BUF->destipaddr, uip_hostaddr)) { + UIP_STAT(++uip_stat.ip.drop); + goto drop; + } + } #else /* UIP_CONF_IPV6 */ /* For IPv6, packet reception is a little trickier as we need to make sure that we listen to certain multicast addresses (all diff --git a/uip/uip.h b/uip/uip.h index 3a6ee66..2433512 100644 --- a/uip/uip.h +++ b/uip/uip.h @@ -1224,8 +1224,8 @@ struct uip_udp_conn { /** * The current UDP connection. */ -extern struct uip_udp_conn *uip_udp_conn; -extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; +extern __xdata struct uip_udp_conn *uip_udp_conn; +extern __xdata struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; #endif /* UIP_UDP */ /**