mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 17:43:39 +08:00
task #10495: Added support for IP_MULTICAST_LOOP at socket- and raw-API level.
This commit is contained in:
@@ -710,13 +710,18 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
LWIP_DEBUGF(IP_DEBUG, ("netif_loop_output()"));
|
||||
return netif_loop_output(netif, p, dest);
|
||||
}
|
||||
#if LWIP_IGMP
|
||||
if ((p->flags & PBUF_FLAG_MCASTLOOP) != 0) {
|
||||
netif_loop_output(netif, p, dest);
|
||||
}
|
||||
#endif /* LWIP_IGMP */
|
||||
#endif /* ENABLE_LOOPBACK */
|
||||
#if IP_FRAG
|
||||
/* don't fragment if interface has mtu set to 0 [loopif] */
|
||||
if (netif->mtu && (p->tot_len > netif->mtu)) {
|
||||
return ip_frag(p, netif, dest);
|
||||
}
|
||||
#endif
|
||||
#endif /* IP_FRAG */
|
||||
|
||||
LWIP_DEBUGF(IP_DEBUG, ("netif->output()"));
|
||||
return netif->output(netif, p, dest);
|
||||
|
||||
@@ -540,6 +540,14 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
|
||||
/* in UDP, 0 checksum means 'no checksum' */
|
||||
udphdr->chksum = 0x0000;
|
||||
|
||||
/* Multicast Loop? */
|
||||
#if LWIP_IGMP
|
||||
if (ip_addr_ismulticast(dst_ip) && ((pcb->flags & UDP_FLAGS_MULTICAST_LOOP) != 0)) {
|
||||
q->flags |= PBUF_FLAG_MCASTLOOP;
|
||||
}
|
||||
#endif /* LWIP_IGMP */
|
||||
|
||||
|
||||
/* PCB local address is IP_ANY_ADDR? */
|
||||
if (ip_addr_isany(&pcb->local_ip)) {
|
||||
/* use outgoing network interface IP address as source address */
|
||||
@@ -927,6 +935,10 @@ udp_new(void)
|
||||
/* initialize PCB to all zeroes */
|
||||
memset(pcb, 0, sizeof(struct udp_pcb));
|
||||
pcb->ttl = UDP_TTL;
|
||||
#if LWIP_IGMP
|
||||
/* multicast loopback shall be turned on by default */
|
||||
pcb->flags = PBUF_FLAG_MCASTLOOP;
|
||||
#endif /* LWIP_IGMP */
|
||||
}
|
||||
return pcb;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user