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 <[email protected]>
  • Loading branch information
IVandeVeire authored and carlescufi committed Nov 21, 2023
1 parent ca7ce90 commit 1d0f47b
Show file tree
Hide file tree
Showing 10 changed files with 451 additions and 36 deletions.
15 changes: 12 additions & 3 deletions include/zephyr/net/igmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,31 @@
extern "C" {
#endif

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

/**
* @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,
const 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,
const struct igmp_param *param)
{
ARG_UNUSED(iface);
ARG_UNUSED(addr);
ARG_UNUSED(param);

return -ENOSYS;
}
Expand Down
11 changes: 11 additions & 0 deletions include/zephyr/net/net_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ struct net_if_mcast_addr {
/** IP address */
struct net_addr address;

#if defined(CONFIG_NET_IPV4_IGMPV3)
/** Sources to filter on */
struct net_addr sources[CONFIG_NET_IF_MCAST_IPV4_SOURCE_COUNT];

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

/** Filter mode (used in IGMPV3) */
uint8_t record_type;
#endif

/** Is this multicast IP address used or not */
uint8_t is_used : 1;

Expand Down
4 changes: 4 additions & 0 deletions subsys/net/ip/Kconfig.ipv4
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit 1d0f47b

Please sign in to comment.