Skip to content

Commit 53f01fa

Browse files
rluboskartben
authored andcommitted
net: ip: mld: Ensure MLD APIs work with offloaded interfaces
MLD APIs are commonly used across the codebase to configure IPv6 multicast addresses on network interfaces. Sending MLD reports however works only for native interfaces as it uses low-level APIs. Therefore, in order to make the APIs at least semi-functional for offloaded interfaces as well (i.e. allow to configure multicast address on the interface), return early in case interface is offloaded. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
1 parent e0a1e91 commit 53f01fa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

subsys/net/ip/ipv6_mld.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ int net_ipv6_mld_send_single(struct net_if *iface, const struct in6_addr *addr,
213213
int net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr)
214214
{
215215
struct net_if_mcast_addr *maddr;
216-
int ret;
216+
int ret = 0;
217217

218218
maddr = net_if_ipv6_maddr_lookup(addr, &iface);
219219
if (maddr && net_if_ipv6_maddr_is_joined(maddr)) {
@@ -235,11 +235,16 @@ int net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr)
235235
return -ENETDOWN;
236236
}
237237

238+
if (net_if_is_offloaded(iface)) {
239+
goto out;
240+
}
241+
238242
ret = net_ipv6_mld_send_single(iface, addr, NET_IPV6_MLDv2_CHANGE_TO_EXCLUDE_MODE);
239243
if (ret < 0) {
240244
return ret;
241245
}
242246

247+
out:
243248
net_if_ipv6_maddr_join(iface, maddr);
244249

245250
net_if_mcast_monitor(iface, &maddr->address, true);
@@ -254,7 +259,7 @@ int net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr)
254259
int net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr)
255260
{
256261
struct net_if_mcast_addr *maddr;
257-
int ret;
262+
int ret = 0;
258263

259264
maddr = net_if_ipv6_maddr_lookup(addr, &iface);
260265
if (!maddr) {
@@ -269,11 +274,16 @@ int net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr)
269274
return 0;
270275
}
271276

277+
if (net_if_is_offloaded(iface)) {
278+
goto out;
279+
}
280+
272281
ret = net_ipv6_mld_send_single(iface, addr, NET_IPV6_MLDv2_CHANGE_TO_INCLUDE_MODE);
273282
if (ret < 0) {
274283
return ret;
275284
}
276285

286+
out:
277287
net_if_mcast_monitor(iface, &maddr->address, false);
278288

279289
net_mgmt_event_notify_with_info(NET_EVENT_IPV6_MCAST_LEAVE, iface,

0 commit comments

Comments
 (0)