Skip to content

Commit 8525a1f

Browse files
authored
Fix option value type for IPV6_MULTICAST_LOOP and allow iface index for IPV6_MULTICAST_IF
1 parent 7fc7960 commit 8525a1f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

groups/nts/ntsu/ntsu_socketoptionutil.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,8 @@ ntsa::Error SocketOptionUtil::setMulticastLoopback(ntsa::Handle socket,
15471547
}
15481548
}
15491549
else if (socketAddress.ss_family == AF_INET6) {
1550-
u_char optionValue = enabled ? 1 : 0;
1551-
int rc = ::setsockopt(socket,
1550+
u_int optionValue = enabled ? 1 : 0;
1551+
int rc = ::setsockopt(socket,
15521552
IPPROTO_IPV6,
15531553
IPV6_MULTICAST_LOOP,
15541554
reinterpret_cast<char*>(&optionValue),
@@ -1584,8 +1584,10 @@ ntsa::Error SocketOptionUtil::setMulticastInterface(
15841584
}
15851585
}
15861586
else if (interface.isV6()) {
1587-
bsl::uint32_t optionValue =
1587+
bsl::uint32_t optionValue = interface.v6().scopeId();
1588+
if (optionValue == 0) {
15881589
ntsu::AdapterUtil::discoverInterfaceIndex(interface.v6());
1590+
}
15891591

15901592
int rc = ::setsockopt(socket,
15911593
IPPROTO_IPV6,

0 commit comments

Comments
 (0)