Skip to content

Commit

Permalink
If multicast address already exists in group, lookup the address and …
Browse files Browse the repository at this point in the history
…continue instead thorwing error
  • Loading branch information
Aadithya Prakash authored and Aadithya Prakash committed Jul 25, 2022
1 parent 5f06de2 commit ed09c55
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/system/zephyr/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,24 @@ void *_zn_listen_udp_multicast(void *arg, unsigned long tout, const z_str_t ifac
{
struct net_if_mcast_addr *mcast = NULL;
mcast = net_if_ipv4_maddr_add(ifa, &((struct sockaddr_in *)raddr->ai_addr)->sin_addr);
// TODO: Do the same address lookup as in the IPV6 case below
if (!mcast)
goto _ZN_LISTEN_UDP_MULTICAST_ERROR_2;
net_if_ipv4_maddr_join(mcast);
}
else if (raddr->ai_family == AF_INET6)
{
struct net_if_mcast_addr *mcast = NULL;
mcast = net_if_ipv6_maddr_add(ifa, &((struct sockaddr_in6 *)raddr->ai_addr)->sin6_addr);
// We don't want to fail if the address already exists in the multicast group.
mcast = net_if_ipv6_maddr_lookup(&((struct sockaddr_in6 *)raddr->ai_addr)->sin6_addr, &ifa);
if (!mcast)
goto _ZN_LISTEN_UDP_MULTICAST_ERROR_2;
{
mcast = net_if_ipv6_maddr_add(ifa, &((struct sockaddr_in6 *)raddr->ai_addr)->sin6_addr);
if (!mcast)
{
goto _ZN_LISTEN_UDP_MULTICAST_ERROR_2;
}
}
net_if_ipv6_maddr_join(mcast);
}
else
Expand Down

0 comments on commit ed09c55

Please sign in to comment.