Skip to content

Commit 934b55e

Browse files
markaj-nordicrlubos
authored andcommitted
[nrf fromtree] net: if: Extend the usage of rejoining the multicast groups
It may happen that the interface is up but not yet running when we issue the rejoin_ipv6_mcast_groups(). This can be fixed by calling this function again right after the iface is set to 'running' state in the notify_iface_up handler. Signed-off-by: Marcin Kajor <[email protected]> (cherry picked from commit b571e45)
1 parent 7c0c899 commit 934b55e

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

subsys/net/ip/net_if.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4633,6 +4633,18 @@ bool net_if_is_offloaded(struct net_if *iface)
46334633
net_if_is_socket_offloaded(iface));
46344634
}
46354635

4636+
static void rejoin_multicast_groups(struct net_if *iface)
4637+
{
4638+
#if defined(CONFIG_NET_NATIVE_IPV6)
4639+
rejoin_ipv6_mcast_groups(iface);
4640+
if (l2_flags_get(iface) & NET_L2_MULTICAST) {
4641+
join_mcast_allnodes(iface);
4642+
}
4643+
#else
4644+
ARG_UNUSED(iface);
4645+
#endif
4646+
}
4647+
46364648
static void notify_iface_up(struct net_if *iface)
46374649
{
46384650
/* In many places it's assumed that link address was set with
@@ -4659,6 +4671,10 @@ static void notify_iface_up(struct net_if *iface)
46594671
*/
46604672
if (!net_if_is_offloaded(iface) &&
46614673
!(l2_flags_get(iface) & NET_L2_POINT_TO_POINT)) {
4674+
/* Make sure that we update the IPv6 addresses and join the
4675+
* multicast groups.
4676+
*/
4677+
rejoin_multicast_groups(iface);
46624678
iface_ipv6_start(iface);
46634679
net_ipv4_autoconf_start(iface);
46644680
}
@@ -4780,13 +4796,6 @@ static void init_igmp(struct net_if *iface)
47804796
#endif
47814797
}
47824798

4783-
static void rejoin_multicast_groups(struct net_if *iface)
4784-
{
4785-
#if defined(CONFIG_NET_NATIVE_IPV6)
4786-
rejoin_ipv6_mcast_groups(iface);
4787-
#endif
4788-
}
4789-
47904799
int net_if_up(struct net_if *iface)
47914800
{
47924801
int status = 0;
@@ -4844,14 +4853,6 @@ int net_if_up(struct net_if *iface)
48444853
net_mgmt_event_notify(NET_EVENT_IF_ADMIN_UP, iface);
48454854
update_operational_state(iface);
48464855

4847-
if (!net_if_is_offloaded(iface)) {
4848-
/* Make sure that we update the IPv6 addresses and join the
4849-
* multicast groups.
4850-
*/
4851-
rejoin_multicast_groups(iface);
4852-
net_if_start_dad(iface);
4853-
}
4854-
48554856
out:
48564857
net_if_unlock(iface);
48574858

0 commit comments

Comments
 (0)