tests: net: igmp: Add re-join multicast group test

Make sure we send IGMP report when re-joining the multicast group
when interface goes up after operative down event.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2024-12-17 11:06:40 +02:00 committed by Benjamin Cabé
parent 24bf9c2334
commit 9fcf424d41

View file

@ -620,4 +620,25 @@ ZTEST_USER(net_igmp, test_igmpv2_query)
igmp_send_query(false);
}
ZTEST_USER(net_igmp, test_group_rejoin)
{
/* It is enough if this is tested with IGMPv2 only because we do not
* really care about specific IGMP version here.
*/
if (IS_ENABLED(CONFIG_NET_IPV4_IGMPV3)) {
ztest_test_skip();
}
socket_join_group_with_index(&my_addr);
is_report_sent = false;
net_if_carrier_off(net_iface);
net_if_carrier_on(net_iface);
zassert_true(is_report_sent, "Did not catch query event");
socket_leave_group_with_index(&my_addr);
}
ZTEST_SUITE(net_igmp, NULL, igmp_setup, NULL, NULL, igmp_teardown);