Skip to content

Commit

Permalink
net: ip: igmp: add igmpv3 support
Browse files Browse the repository at this point in the history
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 <ibe.vandeveire@basalte.be>
  • Loading branch information
IVandeVeire committed Nov 20, 2023
1 parent b0a0151 commit 5e0b19d
Show file tree
Hide file tree
Showing 10 changed files with 459 additions and 41 deletions.
16 changes: 12 additions & 4 deletions include/zephyr/net/igmp.h
Expand Up @@ -27,29 +27,37 @@
extern "C" {
#endif

struct igmp_param {
bool include; /* Source list filter type */
struct in_addr *source_list; /* List of sources to include or exclude */
size_t sources_len; /* Length of source list */
};

/**
* @brief Join a given multicast group.
*
* @param iface Network interface where join message is sent
* @param addr Multicast group to join
* @param param Optional parameters
*
* @return Return 0 if joining was done, <0 otherwise.
*/
#if defined(CONFIG_NET_IPV4_IGMP)
int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr);
int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr, struct igmp_param *param);
#else
static inline int net_ipv4_igmp_join(struct net_if *iface,
const struct in_addr *addr)
static inline int net_ipv4_igmp_join(struct net_if *iface, const struct in_addr *addr,
struct igmp_param *param)
{
ARG_UNUSED(iface);
ARG_UNUSED(addr);
ARG_UNUSED(param);

return -ENOSYS;
}
#endif

/**
* @brief Leave a given multicast group.
* @brief Leave a given multicast.
*
* @param iface Network interface where leave message is sent
* @param addr Multicast group to leave
Expand Down
11 changes: 11 additions & 0 deletions include/zephyr/net/net_if.h
Expand Up @@ -101,6 +101,17 @@ struct net_if_mcast_addr {
uint8_t is_joined : 1;

uint8_t _unused : 6;

#if defined(CONFIG_NET_IPV4_IGMPV3)
/** Filter mode (used in IGMPV3)*/
uint8_t record_type;

/** Number of sources to be used by the filter*/
uint16_t sources_len;

/** Sources to filter on*/
struct net_addr sources[CONFIG_NET_IF_MCAST_IPV4_SOURCE_COUNT];
#endif
};

/**
Expand Down
4 changes: 4 additions & 0 deletions subsys/net/ip/Kconfig.ipv4
Expand Up @@ -37,6 +37,10 @@ config NET_IF_MCAST_IPV4_ADDR_COUNT
default 2 if NET_IPV4_IGMP
default 1

config NET_IF_MCAST_IPV4_SOURCE_COUNT
int "Max number of IPv4 sources per mcast address to be included or excluded"
default 1

config NET_ICMPV4_ACCEPT_BROADCAST
bool "Accept broadcast ICMPv4 echo-request"
help
Expand Down

0 comments on commit 5e0b19d

Please sign in to comment.