Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not send multicast message using thread-only source addresses #772

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions port/linux/ipadapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,14 @@ oc_send_discovery_request(oc_message_t *message)
if ((message->endpoint.flags & IPV6) && iface->ifa_addr &&
iface->ifa_addr->sa_family == AF_INET6) {
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)iface->ifa_addr;
// check for Thread mesh local prefix
memcpy(&message->endpoint.addr_local.ipv6.address, &addr->sin6_addr, 16);
uint8_t *epaddr = message->endpoint.addr_local.ipv6.address;
uint8_t thread_prefix[8] = { 0xfd, 0xde, 0xad, 0x00,
0xbe, 0xef, 0x00, 0x00 };
bool is_thread_mesh = memcmp(epaddr, thread_prefix, 8) == 0;
if (is_thread_mesh)
continue;
unsigned int mif = if_nametoindex(iface->ifa_name);
if (setsockopt(dev->server_sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, &mif,
sizeof(mif)) == -1) {
Expand Down
Loading