From 3230caf9a1aad7a9d5870e01598aa87c2be782de Mon Sep 17 00:00:00 2001 From: Julius G Date: Mon, 23 Oct 2023 12:01:14 +0200 Subject: [PATCH] Fix IPv6 SD (#462) Co-authored-by: Julius Gesang --- .../endpoints/include/udp_server_endpoint_impl_receive_op.hpp | 2 +- implementation/endpoints/src/udp_server_endpoint_impl.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp index 5941bc794..e9d5a6fa6 100644 --- a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp +++ b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp @@ -143,9 +143,9 @@ struct udp_server_endpoint_impl_receive_op { boost::asio::ip::address_v6::bytes_type its_bytes; // sender - boost::asio::ip::address_v6 its_sender_address; for (size_t i = 0; i < its_bytes.size(); i++) its_bytes[i] = addr.v6.sin6_addr.s6_addr[i]; + boost::asio::ip::address_v6 its_sender_address(its_bytes); in_port_t its_sender_port(ntohs(addr.v6.sin6_port)); sender_ = endpoint_type_t(its_sender_address, its_sender_port); diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp index 02e24c8c6..440cbcfe8 100644 --- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp @@ -861,7 +861,7 @@ udp_server_endpoint_impl::set_multicast_option( int its_pktinfo_option(1); ::setsockopt(multicast_socket_->native_handle(), (is_v4_ ? IPPROTO_IP : IPPROTO_IPV6), - (is_v4_ ? IP_PKTINFO : IPV6_PKTINFO), + (is_v4_ ? IP_PKTINFO : IPV6_RECVPKTINFO), &its_pktinfo_option, sizeof(its_pktinfo_option)); #endif