From ad848dcfbf8f9976748d08b5b50a848dc4d377fc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 3 May 2016 08:35:02 +0300 Subject: [PATCH] net: Add multicast address to network interface Change-Id: Ifc09d2e1d3ac44ab0f5980ee17299119fbe2a867 Signed-off-by: Jukka Rissanen --- include/net/net_if.h | 2 -- include/net/yaip/net_if.h | 18 ++++++++++++++++++ net/yaip/Kconfig | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/net/net_if.h b/include/net/net_if.h index 8cf38c6aec9..402d6c4f639 100644 --- a/include/net/net_if.h +++ b/include/net/net_if.h @@ -18,6 +18,4 @@ #include #elif defined(CONFIG_NET_YAIP) #include -#else -#error "Either uIP or YAIP needs to be selected." #endif diff --git a/include/net/yaip/net_if.h b/include/net/yaip/net_if.h index 38306d75244..cd67423680e 100644 --- a/include/net/yaip/net_if.h +++ b/include/net/yaip/net_if.h @@ -65,6 +65,20 @@ struct net_if_addr { #endif /* CONFIG_NET_IPV6 */ }; +/** + * @brief Network Interface multicast IP addresses + * + * Stores the multicast IP addresses assigned to this network interface. + * + */ +struct net_if_mcast_addr { + /** Is this multicast IP address used or not */ + bool is_used; + + /** IP address */ + struct net_addr address; +}; + /** * @brief Network Interface structure * @@ -90,9 +104,13 @@ struct net_if { #if defined(CONFIG_NET_IPV6) #define NET_IF_MAX_IPV6_ADDR CONFIG_NET_IFACE_UNICAST_IPV6_ADDR_COUNT +#define NET_IF_MAX_IPV6_MADDR CONFIG_NET_IFACE_MCAST_IPV6_ADDR_COUNT struct { /** Unicast IP addresses */ struct net_if_addr unicast[NET_IF_MAX_IPV6_ADDR]; + + /** Multicast IP addresses */ + struct net_if_mcast_addr mcast[NET_IF_MAX_IPV6_MADDR]; } ipv6; uint8_t hop_limit; diff --git a/net/yaip/Kconfig b/net/yaip/Kconfig index f0e64b06064..21361f179e8 100644 --- a/net/yaip/Kconfig +++ b/net/yaip/Kconfig @@ -23,3 +23,7 @@ config NET_YAIP_INIT_PRIO config NET_IFACE_UNICAST_IPV6_ADDR_COUNT int "Max number of unicast IPv6 addresses assigned to network interface" default 1 + +config NET_IFACE_MCAST_IPV6_ADDR_COUNT + int "Max number of multicast IPv6 addresses assigned to network interface" + default 1