Skip to content

Commit 1d0f47b

Browse files
IVandeVeirecarlescufi
authored andcommitted
net: ip: igmp: add igmpv3 support
Added igmpv3 support based on the already existing structure for igmpv2. The already existing api is not modified to prevent breaking exisiting applications. Signed-off-by: Ibe Van de Veire <[email protected]>
1 parent ca7ce90 commit 1d0f47b

File tree

10 files changed

+451
-36
lines changed

10 files changed

+451
-36
lines changed

include/zephyr/net/igmp.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,31 @@
2727
extern "C" {
2828
#endif
2929

30+
struct igmp_param {
31+
struct in_addr *source_list; /* List of sources to include or exclude */
32+
size_t sources_len; /* Length of source list */
33+
bool include; /* Source list filter type */
34+
};
35+
3036
/**
3137
* @brief Join a given multicast group.
3238
*
3339
* @param iface Network interface where join message is sent
3440
* @param addr Multicast group to join
41+
* @param param Optional parameters
3542
*
3643
* @return Return 0 if joining was done, <0 otherwise.
3744
*/
3845
#if defined(CONFIG_NET_IPV4_IGMP)
39-
int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr);
46+
int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr,
47+
const struct igmp_param *param);
4048
#else
41-
static inline int net_ipv4_igmp_join(struct net_if *iface,
42-
const struct in_addr *addr)
49+
static inline int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr,
50+
const struct igmp_param *param)
4351
{
4452
ARG_UNUSED(iface);
4553
ARG_UNUSED(addr);
54+
ARG_UNUSED(param);
4655

4756
return -ENOSYS;
4857
}

include/zephyr/net/net_if.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ struct net_if_mcast_addr {
9494
/** IP address */
9595
struct net_addr address;
9696

97+
#if defined(CONFIG_NET_IPV4_IGMPV3)
98+
/** Sources to filter on */
99+
struct net_addr sources[CONFIG_NET_IF_MCAST_IPV4_SOURCE_COUNT];
100+
101+
/** Number of sources to be used by the filter */
102+
uint16_t sources_len;
103+
104+
/** Filter mode (used in IGMPV3) */
105+
uint8_t record_type;
106+
#endif
107+
97108
/** Is this multicast IP address used or not */
98109
uint8_t is_used : 1;
99110

subsys/net/ip/Kconfig.ipv4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ config NET_IF_MCAST_IPV4_ADDR_COUNT
3737
default 2 if NET_IPV4_IGMP
3838
default 1
3939

40+
config NET_IF_MCAST_IPV4_SOURCE_COUNT
41+
int "Max number of IPv4 sources per mcast address to be included or excluded"
42+
default 1
43+
4044
config NET_ICMPV4_ACCEPT_BROADCAST
4145
bool "Accept broadcast ICMPv4 echo-request"
4246
help

0 commit comments

Comments
 (0)