udp_input: use SO_REUSE && SO_REUSE_RXTOALL to copy incoming (broad-/multicast) data to additional pcbs

This commit is contained in:
goldsimon 2010-05-15 16:46:53 +00:00
parent a945bf07af
commit 02f5e19420

View File

@ -276,7 +276,7 @@ udp_input(struct pbuf *p, struct netif *inp)
} }
if (pcb != NULL) { if (pcb != NULL) {
snmp_inc_udpindatagrams(); snmp_inc_udpindatagrams();
#if SO_REUSE_RXTOALL #if SO_REUSE && SO_REUSE_RXTOALL
if ((broadcast || ip_addr_ismulticast(&iphdr->dest)) && if ((broadcast || ip_addr_ismulticast(&iphdr->dest)) &&
((pcb->so_options & SOF_REUSEADDR) != 0)) { ((pcb->so_options & SOF_REUSEADDR) != 0)) {
/* pass broadcast- or multicast packets to all multicast pcbs /* pass broadcast- or multicast packets to all multicast pcbs
@ -317,7 +317,7 @@ udp_input(struct pbuf *p, struct netif *inp)
/* and move payload to UDP data again */ /* and move payload to UDP data again */
pbuf_header(p, -(s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN)); pbuf_header(p, -(s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN));
} }
#endif /* SO_REUSE_RXTOALL */ #endif /* SO_REUSE && SO_REUSE_RXTOALL */
/* callback */ /* callback */
if (pcb->recv != NULL) { if (pcb->recv != NULL) {
/* now the recv function is responsible for freeing p */ /* now the recv function is responsible for freeing p */