patch #6888: Patch for UDP Netbufs to support dest-addr and dest-port

This commit is contained in:
goldsimon
2009-10-07 17:58:30 +00:00
parent 9e5cf1cf8e
commit a9cbdc141b
5 changed files with 34 additions and 0 deletions

View File

@@ -168,6 +168,15 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
buf->ptr = p;
buf->addr = addr;
buf->port = port;
#if LWIP_NETBUF_RECVINFO
{
const struct ip_hdr* iphdr = ip_current_header();
/* get the UDP header - always in the first pbuf, ensured by udp_input */
const struct udp_hdr* udphdr = (void*)(((char*)iphdr) + IPH_LEN(iphdr));
buf->toaddr = (struct ip_addr*)&iphdr->dest;
buf->toport = udphdr->dest;
}
#endif /* LWIP_NETBUF_RECVINFO */
}
if (sys_mbox_trypost(conn->recvmbox, buf) != ERR_OK) {

View File

@@ -62,6 +62,11 @@ netbuf *netbuf_new(void)
buf->p = NULL;
buf->ptr = NULL;
buf->addr = NULL;
buf->port = 0;
#if LWIP_NETBUF_RECVINFO
buf->toaddr = NULL;
buf->toport = 0;
#endif /* LWIP_NETBUF_RECVINFO */
return buf;
} else {
return NULL;