From 0ab21da8205ef7dbe27b2167eae0b974d06b0daf Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Mon, 24 Aug 2015 11:28:13 -0500 Subject: [PATCH] Add multicast support to loopif This commit adds support to send and receive multicast on the loopback netif by enabling IGMP via NETIF_FLAG_IGMP This commit also introduces an LwIP configuration option, LWIP_LOOPIF_MCAST, to control the behavior and it defaults to off --- src/core/netif.c | 3 +++ src/include/lwip/opt.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/core/netif.c b/src/core/netif.c index ccbbe48a..58e64ced 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -126,6 +126,9 @@ netif_loopif_init(struct netif *netif) #endif #if LWIP_IPV6 netif->output_ip6 = netif_loop_output_ipv6; +#endif +#if LWIP_LOOPIF_MCAST + netif->flags |= NETIF_FLAG_IGMP; #endif return ERR_OK; } diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 3615cf41..6de94bb3 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1424,6 +1424,13 @@ #define LWIP_HAVE_LOOPIF LWIP_NETIF_LOOPBACK #endif +/** +* LWIP_LOOPIF_MCAST==1: Support multicast on loop interface (127.0.0.1). +*/ +#ifndef LWIP_LOOPIF_MCAST +#define LWIP_LOOPIF_MCAST 0 +#endif + /* ------------------------------------ ---------- SLIPIF options ----------