udp: add core-level multicast support for IPv6
So far, the UDP core module implemented only IPv4 multicast support. This patch extends the module with the features necessary for socket layers on top to implement IPv6 multicast support as well: o If a UDP PCB is bound to an IPv6 multicast address, a unicast source address is selected and used to send the packet instead, as is required (and was the case for IPv4 multicast already). o Unlike IPv4's IP_MULTICAST_IF socket option, which takes a source IPv4 address, the IPV6_MULTICAST_IF socket option (from RFC 3493) takes an interface identifier to denote the interface to use for outgoing multicast-destined packets. A new pair of UDP PCB API calls, udp_[gs]et_multicast_netif_index(), are added to support this. The new definition "NETIF_NO_INDEX" may be used to indicate that lwIP should pick an interface instead. IPv4 socket implementations may now also choose to map the given source address to an interface index immediately and use the new facility instead of the old udp_[gs]et_multicast_netif_addr() one. A side effect of limiting the old facility to IPv4 is that for dual- stack configurations with multicast support, the UDP PCB size is reduced by (up to) 16 bytes. o For configurations that enable loopback interface support, the IPv6 code now also supports multicast loopback (IPV6_MULTICAST_LOOP). o The LWIP_MULTICAST_TX_OPTIONS opt.h setting now covers both IPv4 and IPv6, and as such is no longer strictly linked to IGMP. It is therefore placed in its own lwIP options subgroup in opt.h. The IPV6_MULTICAST_HOPS socket option can already be implemented using the existing IP_MULTICAST_TTL support, and thus requires no additional changes. Overall, this patch should not break any existing code.
This commit is contained in:
committed by
Dirk Ziegelmeier
parent
4a9db56f4c
commit
ab8119360e
@@ -96,7 +96,7 @@ PACK_STRUCT_END
|
||||
#error "If you want to use DHCP, you have to define LWIP_UDP=1 in your lwipopts.h"
|
||||
#endif
|
||||
#if (!LWIP_UDP && LWIP_MULTICAST_TX_OPTIONS)
|
||||
#error "If you want to use IGMP/LWIP_MULTICAST_TX_OPTIONS, you have to define LWIP_UDP=1 in your lwipopts.h"
|
||||
#error "If you want to use LWIP_MULTICAST_TX_OPTIONS, you have to define LWIP_UDP=1 in your lwipopts.h"
|
||||
#endif
|
||||
#if (!LWIP_UDP && LWIP_DNS)
|
||||
#error "If you want to use DNS, you have to define LWIP_UDP=1 in your lwipopts.h"
|
||||
@@ -123,9 +123,6 @@ PACK_STRUCT_END
|
||||
#if (LWIP_IGMP && !LWIP_IPV4)
|
||||
#error "IGMP needs LWIP_IPV4 enabled in your lwipopts.h"
|
||||
#endif
|
||||
#if (LWIP_MULTICAST_TX_OPTIONS && !LWIP_IPV4)
|
||||
#error "LWIP_MULTICAST_TX_OPTIONS needs LWIP_IPV4 enabled in your lwipopts.h"
|
||||
#endif
|
||||
#if ((LWIP_NETCONN || LWIP_SOCKET) && (MEMP_NUM_TCPIP_MSG_API<=0))
|
||||
#error "If you want to use Sequential API, you have to define MEMP_NUM_TCPIP_MSG_API>=1 in your lwipopts.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user