diff -Nurp lwip-1.3.1.rc2/src/api/api_msg.c LwIP_1312/Source/api/api_msg.c
--- lwip-1.3.1.rc2/src/api/api_msg.c	2009-07-27 16:43:42.000000000 +0200
+++ LwIP_1312/Source/api/api_msg.c	2009-08-05 11:18:56.959722900 +0200
@@ -133,8 +133,13 @@ recv_raw(void *arg, struct raw_pcb *pcb,
  * @see udp.h (struct udp_pcb.recv) for parameters
  */
 static void
+#if UDP_EXTENDED_INFO
 recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
+   struct ip_addr *addr, u16_t port, struct ip_addr *toaddr, u16_t toport)
+#else
+recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, 
    struct ip_addr *addr, u16_t port)
+#endif
 {
   struct netbuf *buf;
   struct netconn *conn;
@@ -168,6 +173,10 @@ recv_udp(void *arg, struct udp_pcb *pcb,
     buf->ptr = p;
     buf->addr = addr;
     buf->port = port;
+#if UDP_EXTENDED_INFO
+    buf->toaddr = toaddr;
+    buf->toport = toport;
+#endif
   }
 
   if (sys_mbox_trypost(conn->recvmbox, buf) != ERR_OK) {
diff -Nurp lwip-1.3.1.rc2/src/api/netbuf.c LwIP_1312/Source/api/netbuf.c
--- lwip-1.3.1.rc2/src/api/netbuf.c	2009-07-27 16:43:42.000000000 +0200
+++ LwIP_1312/Source/api/netbuf.c	2009-08-05 11:18:56.959722900 +0200
@@ -62,6 +62,10 @@ netbuf *netbuf_new(void)
     buf->p = NULL;
     buf->ptr = NULL;
     buf->addr = NULL;
+#if UDP_EXTENDED_INFO
+    buf->toaddr = NULL;
+    buf->toport = NULL;
+#endif
     return buf;
   } else {
     return NULL;
diff -Nurp lwip-1.3.1.rc2/src/core/udp.c LwIP_1312/Source/core/udp.c
--- lwip-1.3.1.rc2/src/core/udp.c	2009-07-27 16:43:42.000000000 +0200
+++ LwIP_1312/Source/core/udp.c	2009-08-05 11:18:57.037845900 +0200
@@ -282,7 +282,11 @@ udp_input(struct pbuf *p, struct netif *
       /* callback */
       if (pcb->recv != NULL) {
         /* now the recv function is responsible for freeing p */
+#if UDP_EXTENDED_INFO
+        pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src, &(iphdr->dest), dest);
+#else
         pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
+#endif
       } else {
         /* no recv function registered? then we have to free the pbuf! */
         pbuf_free(p);
@@ -752,10 +756,18 @@ udp_disconnect(struct udp_pcb *pcb)
  * @param recv_arg additional argument to pass to the callback function
  */
 void
+#if UDP_EXTENDED_INFO
+udp_recv(struct udp_pcb *pcb,
+         void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
+                       struct ip_addr *addr, u16_t port,
+                       struct ip_addr *toaddr, u16_t toport),
+         void *recv_arg)
+#else
 udp_recv(struct udp_pcb *pcb,
          void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
                        struct ip_addr *addr, u16_t port),
          void *recv_arg)
+#endif
 {
   /* remember recv() callback and user data */
   pcb->recv = recv;
diff -Nurp lwip-1.3.1.rc2/src/include/lwip/netbuf.h LwIP_1312/Source/include/lwip/netbuf.h
--- lwip-1.3.1.rc2/src/include/lwip/netbuf.h	2009-07-27 16:43:42.000000000 +0200
+++ LwIP_1312/Source/include/lwip/netbuf.h	2009-08-05 11:18:57.084719700 +0200
@@ -42,6 +42,10 @@ extern "C" {
 struct netbuf {
   struct pbuf *p, *ptr;
   struct ip_addr *addr;
+#if UDP_EXTENDED_INFO
+  struct ip_addr *toaddr;
+  u16_t toport;
+#endif
   u16_t port;
 };
 
@@ -69,6 +73,10 @@ void              netbuf_first    (struc
 #define netbuf_len(buf)              ((buf)->p->tot_len)
 #define netbuf_fromaddr(buf)         ((buf)->addr)
 #define netbuf_fromport(buf)         ((buf)->port)
+#if UDP_EXTENDED_INFO
+#define netbuf_destaddr(buf)         ((buf)->toaddr)
+#define netbuf_destport(buf)         ((buf)->toport)
+#endif
 
 #ifdef __cplusplus
 }
diff -Nurp lwip-1.3.1.rc2/src/include/lwip/opt.h LwIP_1312/Source/include/lwip/opt.h
--- lwip-1.3.1.rc2/src/include/lwip/opt.h	2009-07-27 16:43:42.000000000 +0200
+++ LwIP_1312/Source/include/lwip/opt.h	2009-08-05 11:18:57.084719700 +0200
@@ -718,6 +718,13 @@
 #define UDP_TTL                         (IP_DEFAULT_TTL)
 #endif
 
+/**
+ * UDP_EXTENDED_INFO==0: append destination addr and port to every netbuf.
+ */
+#ifndef UDP_EXTENDED_INFO
+#define UDP_EXTENDED_INFO           0
+#endif
+
 /*
    ---------------------------------
    ---------- TCP options ----------
diff -Nurp lwip-1.3.1.rc2/src/include/lwip/udp.h LwIP_1312/Source/include/lwip/udp.h
--- lwip-1.3.1.rc2/src/include/lwip/udp.h	2009-07-27 16:43:42.000000000 +0200
+++ LwIP_1312/Source/include/lwip/udp.h	2009-08-05 11:18:57.100344300 +0200
@@ -66,6 +66,7 @@ PACK_STRUCT_END
 #define UDP_FLAGS_NOCHKSUM 0x01U
 #define UDP_FLAGS_UDPLITE  0x02U
 #define UDP_FLAGS_CONNECTED  0x04U
+#define UDP_FLAGS_IS_BROADCAST  0x08U
 
 struct udp_pcb {
 /* Common members of all PCB types */
@@ -117,12 +118,23 @@ err_t            udp_bind       (struct 
 err_t            udp_connect    (struct udp_pcb *pcb, struct ip_addr *ipaddr,
                  u16_t port);
 void             udp_disconnect    (struct udp_pcb *pcb);
+#if UDP_EXTENDED_INFO
+void             udp_recv       (struct udp_pcb *pcb,
+         void (* recv)(void *arg, struct udp_pcb *upcb,
+                 struct pbuf *p,
+                 struct ip_addr *addr,
+                 u16_t port,
+                 struct ip_addr *toaddr,
+                 u16_t toport),
+         void *recv_arg);
+#else
 void             udp_recv       (struct udp_pcb *pcb,
          void (* recv)(void *arg, struct udp_pcb *upcb,
                  struct pbuf *p,
                  struct ip_addr *addr,
                  u16_t port),
          void *recv_arg);
+#endif
 err_t            udp_sendto_if  (struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *dst_ip, u16_t dst_port, struct netif *netif);
 err_t            udp_sendto     (struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *dst_ip, u16_t dst_port);
 err_t            udp_send       (struct udp_pcb *pcb, struct pbuf *p);
