diff options
author | Lutz Bichler <Lutz.Bichler@bmw.de> | 2020-12-04 11:52:58 +0100 |
---|---|---|
committer | Lutz Bichler <Lutz.Bichler@bmw.de> | 2020-12-04 11:52:58 +0100 |
commit | 0f51130b96b5400b87924d8705d0e4a77930cb61 (patch) | |
tree | 0dade462d83a9b4d1de6eb82ab0827d5ec7e93cf | |
parent | 710a8613ee5bd9eb490addecd7f2ee8049c4fd0c (diff) | |
download | vSomeIP-0f51130b96b5400b87924d8705d0e4a77930cb61.tar.gz |
vsomeip 3.1.20.23.1.20.2
18 files changed, 273 insertions, 169 deletions
@@ -1,6 +1,17 @@ Changes ======= +v3.1.20.2 +- Removed special way of detecting boost within NDK (PR #187) +- Allow events/eventgroups to be specified in arbitrary order (Issue #68) +- Allow port 65536 to be used (Issue #80) +- Support IPv6 (Issue #162, PR #179) +- Fix handling of local service history (Issue #163) +- Fix referencing of placeholder events (Issue #175) +- Corrected handling of debounced requests when releasing (Issue #181) +- Fixed possible race when disconnecting (Issue #182) +- Align order of acknowledgement and value sending (Issue #183) + v3.1.20.1 - CMakeLists.txt fixes (by Martin Haase) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fca08f..4f0491a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set (VSOMEIP_COMPAT_NAME vsomeip) set (VSOMEIP_MAJOR_VERSION 3) set (VSOMEIP_MINOR_VERSION 1) set (VSOMEIP_PATCH_VERSION 20) -set (VSOMEIP_HOTFIX_VERSION 1) +set (VSOMEIP_HOTFIX_VERSION 2) set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION}) set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentation/doxygen.in @@ -140,13 +140,7 @@ endif () find_package(Threads REQUIRED) # Boost -if (${CMAKE_SYSTEM_NAME} MATCHES "Android") - # Please implement your macro workaround to set Boost_ variables, because NDK does not have Boost libs package - # Example of macro implementation you can find in test project that mentioned in examples/hello_world/readme_android - ndk_find_package_boost(system thread filesystem) -else() - find_package( Boost 1.55 COMPONENTS system thread filesystem REQUIRED ) -endif() +find_package( Boost 1.55 COMPONENTS system thread filesystem REQUIRED ) include_directories( ${Boost_INCLUDE_DIR} ) if(Boost_FOUND) diff --git a/implementation/configuration/include/event.hpp b/implementation/configuration/include/event.hpp index 701ec0c..84dc5a0 100644 --- a/implementation/configuration/include/event.hpp +++ b/implementation/configuration/include/event.hpp @@ -17,13 +17,15 @@ namespace cfg { struct eventgroup; struct event { - event(event_t _id, bool _is_field, reliability_type_e _reliability) + event(event_t _id) : id_(_id), - is_field_(_is_field), - reliability_(_reliability) { + is_placeholder_(true), + is_field_(false), + reliability_(reliability_type_e::RT_UNRELIABLE) { } event_t id_; + bool is_placeholder_; bool is_field_; reliability_type_e reliability_; std::vector<std::weak_ptr<eventgroup> > groups_; diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp index 475d265..90f1a7b 100644 --- a/implementation/configuration/src/configuration_impl.cpp +++ b/implementation/configuration/src/configuration_impl.cpp @@ -1627,13 +1627,24 @@ void configuration_impl::load_event( } if (its_event_id > 0) { + std::shared_ptr<event> its_event; + auto found_event = _service->events_.find(its_event_id); if (found_event != _service->events_.end()) { - VSOMEIP_ERROR << "Multiple configurations for event [" - << std::hex << _service->service_ << "." - << _service->instance_ << "." - << its_event_id << "]"; + if (found_event->second->is_placeholder_) { + its_event = found_event->second; + } else { + VSOMEIP_ERROR << "Multiple configurations for event [" + << std::hex << _service->service_ << "." + << _service->instance_ << "." + << its_event_id << "]"; + } } else { + its_event = std::make_shared<event>(its_event_id); + _service->events_[its_event_id] = its_event; + } + + if (its_event) { // If event reliability type was not configured, if (its_reliability == reliability_type_e::RT_UNKNOWN) { if (_service->unreliable_ != ILLEGAL_PORT) { @@ -1649,9 +1660,9 @@ void configuration_impl::load_event( ? "RT_RELIABLE" : "RT_UNRELIABLE"); } - std::shared_ptr<event> its_event = std::make_shared<event>( - its_event_id, its_is_field, its_reliability); - _service->events_[its_event_id] = its_event; + its_event->is_placeholder_ = false; + its_event->reliability_ = its_reliability; + its_event->is_field_ = its_is_field; } } } @@ -1715,8 +1726,7 @@ void configuration_impl::load_eventgroup( if (find_event != _service->events_.end()) { its_event = find_event->second; } else { - its_event = std::make_shared<event>(its_event_id, - false, reliability_type_e::RT_UNRELIABLE); + its_event = std::make_shared<event>(its_event_id); } if (its_event) { its_event->groups_.push_back(its_eventgroup); diff --git a/implementation/endpoints/src/endpoint_manager_impl.cpp b/implementation/endpoints/src/endpoint_manager_impl.cpp index 32ba31d..38dabf7 100644 --- a/implementation/endpoints/src/endpoint_manager_impl.cpp +++ b/implementation/endpoints/src/endpoint_manager_impl.cpp @@ -266,7 +266,9 @@ std::shared_ptr<endpoint> endpoint_manager_impl::create_server_endpoint( << " Server endpoint creation failed." << " Reason: "<< e.what() << " Port: " << _port - << " (" << _reliable << ")"; + << " (reliable=" + << (_reliable ? "reliable" : "unreliable") + << ")"; } return (its_endpoint); diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp index c490f53..3debcc7 100644 --- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp @@ -175,26 +175,24 @@ void tcp_client_endpoint_impl::connect() { } #endif - // In case a client endpoint port was configured, - // bind to it before connecting - if (local_.port() != ILLEGAL_PORT) { - boost::system::error_code its_bind_error; - socket_->bind(local_, its_bind_error); - if(its_bind_error) { - VSOMEIP_WARNING << "tcp_client_endpoint::connect: " - "Error binding socket: " << its_bind_error.message() - << " remote:" << get_address_port_remote(); - try { - // don't connect on bind error to avoid using a random port - strand_.post(std::bind(&client_endpoint_impl::connect_cbk, - shared_from_this(), its_bind_error)); - } catch (const std::exception &e) { - VSOMEIP_ERROR << "tcp_client_endpoint_impl::connect: " - << e.what() << " remote:" << get_address_port_remote(); - } - return; + // Bind address and, optionally, port. + boost::system::error_code its_bind_error; + socket_->bind(local_, its_bind_error); + if(its_bind_error) { + VSOMEIP_WARNING << "tcp_client_endpoint::connect: " + "Error binding socket: " << its_bind_error.message() + << " remote:" << get_address_port_remote(); + try { + // don't connect on bind error to avoid using a random port + strand_.post(std::bind(&client_endpoint_impl::connect_cbk, + shared_from_this(), its_bind_error)); + } catch (const std::exception &e) { + VSOMEIP_ERROR << "tcp_client_endpoint_impl::connect: " + << e.what() << " remote:" << get_address_port_remote(); } + return; } + state_ = cei_state_e::CONNECTING; connect_timepoint_ = std::chrono::steady_clock::now(); aborted_restart_count_ = 0; diff --git a/implementation/endpoints/src/udp_client_endpoint_impl.cpp b/implementation/endpoints/src/udp_client_endpoint_impl.cpp index ff24173..dc7a7bf 100644 --- a/implementation/endpoints/src/udp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_client_endpoint_impl.cpp @@ -84,11 +84,6 @@ void udp_client_endpoint_impl::connect() { } } - if (local_.port() == ILLEGAL_PORT) { - // Let the OS assign the port - local_.port(0); - } - #ifndef _WIN32 // If specified, bind to device std::string its_device(configuration_->get_device()); @@ -100,25 +95,22 @@ void udp_client_endpoint_impl::connect() { } #endif - // In case a client endpoint port was configured, - // bind to it before connecting - if (local_.port() != ILLEGAL_PORT) { - boost::system::error_code its_bind_error; - socket_->bind(local_, its_bind_error); - if(its_bind_error) { - VSOMEIP_WARNING << "udp_client_endpoint::connect: " - "Error binding socket: " << its_bind_error.message() - << " remote:" << get_address_port_remote(); - try { - // don't connect on bind error to avoid using a random port - strand_.post(std::bind(&client_endpoint_impl::connect_cbk, - shared_from_this(), its_bind_error)); - } catch (const std::exception &e) { - VSOMEIP_ERROR << "udp_client_endpoint_impl::connect: " - << e.what() << " remote:" << get_address_port_remote(); - } - return; + // Bind address and, optionally, port. + boost::system::error_code its_bind_error; + socket_->bind(local_, its_bind_error); + if(its_bind_error) { + VSOMEIP_WARNING << "udp_client_endpoint::connect: " + "Error binding socket: " << its_bind_error.message() + << " remote:" << get_address_port_remote(); + try { + // don't connect on bind error to avoid using a random port + strand_.post(std::bind(&client_endpoint_impl::connect_cbk, + shared_from_this(), its_bind_error)); + } catch (const std::exception &e) { + VSOMEIP_ERROR << "udp_client_endpoint_impl::connect: " + << e.what() << " remote:" << get_address_port_remote(); } + return; } state_ = cei_state_e::CONNECTING; diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp index add828c..bd6fc62 100644 --- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp @@ -369,12 +369,22 @@ void udp_server_endpoint_impl::join_unlocked(const std::string &_address) { #ifdef _WIN32 const char* optval("0001"); - ::setsockopt(multicast_socket_->native_handle(), IPPROTO_IP, IP_PKTINFO, - optval, sizeof(optval)); + if (is_v4) { + ::setsockopt(multicast_socket_->native_handle(), IPPROTO_IP, IP_PKTINFO, + optval, sizeof(optval)); + } else if (is_v6) { + ::setsockopt(multicast_socket_->native_handle(), IPPROTO_IPV6, IPV6_PKTINFO, + optval, sizeof(optval)); + } #else int optval(1); - ::setsockopt(multicast_socket_->native_handle(), IPPROTO_IP, IP_PKTINFO, - &optval, sizeof(optval)); + if (is_v4) { + ::setsockopt(multicast_socket_->native_handle(), IPPROTO_IP, IP_PKTINFO, + &optval, sizeof(optval)); + } else { + ::setsockopt(multicast_socket_->native_handle(), IPPROTO_IPV6, IPV6_RECVPKTINFO, + &optval, sizeof(optval)); + } #endif multicast_id_++; receive_multicast(multicast_id_); diff --git a/implementation/helper/1.55/boost/asio/detail/impl/socket_ops_ext.ipp b/implementation/helper/1.55/boost/asio/detail/impl/socket_ops_ext.ipp index fe90e83..fb6f77b 100644 --- a/implementation/helper/1.55/boost/asio/detail/impl/socket_ops_ext.ipp +++ b/implementation/helper/1.55/boost/asio/detail/impl/socket_ops_ext.ipp @@ -59,20 +59,30 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, if (result >= 0) { ec = boost::system::error_code(); - // Find destination address - for (LPWSACMSGHDR cmsg = WSA_CMSG_FIRSTHDR(&msg); - cmsg != NULL; - cmsg = WSA_CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); - if (pi) - { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } - } + // Find destination address + for (LPWSACMSGHDR cmsg = WSA_CMSG_FIRSTHDR(&msg); + cmsg != NULL; + cmsg = WSA_CMSG_NXTHDR(&msg, cmsg)) + { + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) + { + struct in6_pktinfo *pi = (struct in6_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } + } } else { dwNumberOfBytesRecvd = -1; } @@ -91,20 +101,30 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, if (result >= 0) { ec = boost::system::error_code(); - // Find destination address - for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); - cmsg != NULL; - cmsg = CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); - if (pi) - { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } - } + // Find destination address + for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); + cmsg != NULL; + cmsg = CMSG_NXTHDR(&msg, cmsg)) + { + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) + { + struct in6_pktinfo *pi = (struct in6_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } + } } return result; #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) diff --git a/implementation/helper/1.66/boost/asio/detail/impl/socket_ops_ext.ipp b/implementation/helper/1.66/boost/asio/detail/impl/socket_ops_ext.ipp index 633d24e..4849766 100644 --- a/implementation/helper/1.66/boost/asio/detail/impl/socket_ops_ext.ipp +++ b/implementation/helper/1.66/boost/asio/detail/impl/socket_ops_ext.ipp @@ -59,20 +59,30 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, if (result >= 0) { ec = boost::system::error_code(); - // Find destination address - for (LPWSACMSGHDR cmsg = WSA_CMSG_FIRSTHDR(&msg); - cmsg != NULL; - cmsg = WSA_CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); - if (pi) - { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } - } + // Find destination address + for (LPWSACMSGHDR cmsg = WSA_CMSG_FIRSTHDR(&msg); + cmsg != NULL; + cmsg = WSA_CMSG_NXTHDR(&msg, cmsg)) + { + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) + { + struct in6_pktinfo *pi = (struct in6_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } + } } else { dwNumberOfBytesRecvd = -1; } @@ -91,20 +101,30 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, if (result >= 0) { ec = boost::system::error_code(); - // Find destination address - for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); - cmsg != NULL; - cmsg = CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); - if (pi) - { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } - } + // Find destination address + for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); + cmsg != NULL; + cmsg = CMSG_NXTHDR(&msg, cmsg)) + { + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) + { + struct in6_pktinfo *pi = (struct in6_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } + } } return result; #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) diff --git a/implementation/helper/1.70/boost/asio/detail/impl/socket_ops_ext.ipp b/implementation/helper/1.70/boost/asio/detail/impl/socket_ops_ext.ipp index 5825796..a4546ca 100644 --- a/implementation/helper/1.70/boost/asio/detail/impl/socket_ops_ext.ipp +++ b/implementation/helper/1.70/boost/asio/detail/impl/socket_ops_ext.ipp @@ -64,14 +64,24 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, cmsg != NULL; cmsg = WSA_CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); - if (pi) + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } + struct in6_pktinfo *pi = (struct in6_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } } } else { dwNumberOfBytesRecvd = -1; @@ -96,14 +106,24 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); - if (pi) + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } + struct in6_pktinfo *pi = (struct in6_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } } } return result; diff --git a/implementation/helper/1.74/boost/asio/detail/impl/socket_ops_ext.ipp b/implementation/helper/1.74/boost/asio/detail/impl/socket_ops_ext.ipp index d9585f6..39e2ed8 100644 --- a/implementation/helper/1.74/boost/asio/detail/impl/socket_ops_ext.ipp +++ b/implementation/helper/1.74/boost/asio/detail/impl/socket_ops_ext.ipp @@ -67,14 +67,24 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, cmsg != NULL; cmsg = WSA_CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); - if (pi) + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } + struct in6_pktinfo *pi = (struct in6_pktinfo *) WSA_CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } } } else { dwNumberOfBytesRecvd = -1; @@ -100,14 +110,24 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO) - continue; - - struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); - if (pi) + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); + } + } else + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { - da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr)); - } + struct in6_pktinfo *pi = (struct in6_pktinfo *) CMSG_DATA(cmsg); + if (pi) + { + boost::asio::ip::address_v6::bytes_type b; + memcpy(b.data(), pi->ipi6_addr.s6_addr, sizeof(pi->ipi6_addr.s6_addr)); + da = boost::asio::ip::address_v6(b); + } + } } } return result; diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp index e187d93..afdf5ae 100644 --- a/implementation/routing/src/routing_manager_base.cpp +++ b/implementation/routing/src/routing_manager_base.cpp @@ -442,7 +442,8 @@ void routing_manager_base::register_event(client_t _client, } } } - if(!_is_cache_placeholder) { + + if (!its_event->is_cache_placeholder()) { its_event->add_ref(_client, _is_provided); } @@ -1045,7 +1046,9 @@ void routing_manager_base::remove_local(client_t _client, for (auto& sic : its_clients) { local_services_history_[std::get<0>(sic)][std::get<1>(sic)].erase(std::get<2>(sic)); if (local_services_history_[std::get<0>(sic)][std::get<1>(sic)].size() == 0) { - local_services_history_.erase(std::get<0>(sic)); + local_services_history_[std::get<0>(sic)].erase(std::get<1>(sic)); + if (local_services_history_[std::get<0>(sic)].size() == 0) + local_services_history_.erase(std::get<0>(sic)); } } } diff --git a/implementation/routing/src/routing_manager_proxy.cpp b/implementation/routing/src/routing_manager_proxy.cpp index 410559b..3eba2a5 100644 --- a/implementation/routing/src/routing_manager_proxy.cpp +++ b/implementation/routing/src/routing_manager_proxy.cpp @@ -292,18 +292,17 @@ void routing_manager_proxy::release_service(client_t _client, std::lock_guard<std::mutex> its_lock(state_mutex_); remove_pending_subscription(_service, _instance, 0xFFFF, ANY_EVENT); - bool pending(false); auto it = requests_to_debounce_.begin(); while (it != requests_to_debounce_.end()) { if (it->service_ == _service && it->instance_ == _instance) { - pending = true; + break; } it++; } - if (it != requests_to_debounce_.end()) requests_to_debounce_.erase(it); - - if (!pending && state_ == inner_state_type_e::ST_REGISTERED) { + if (it != requests_to_debounce_.end()) { + requests_to_debounce_.erase(it); + } else if (state_ == inner_state_type_e::ST_REGISTERED) { send_release_service(_client, _service, _instance); } @@ -840,11 +839,14 @@ void routing_manager_proxy::on_connect(const std::shared_ptr<endpoint>& _endpoin } void routing_manager_proxy::on_disconnect(const std::shared_ptr<endpoint>& _endpoint) { - { - std::lock_guard<std::mutex> its_lock(sender_mutex_); - is_connected_ = !(_endpoint == sender_); - } - if (!is_connected_) { + + bool is_disconnected((_endpoint == sender_)); + if (is_disconnected) { + { + std::lock_guard<std::mutex> its_lock(sender_mutex_); + is_connected_ = false; + } + VSOMEIP_INFO << "routing_manager_proxy::on_disconnect: Client 0x" << std::hex << get_client() << " calling host_->on_state " << "with DEREGISTERED"; @@ -1755,11 +1757,11 @@ void routing_manager_proxy::on_routing_info(const byte_t *_data, send_subscribe_nack(si.client_id_, si.service_id_, si.instance_id_, si.eventgroup_id_, si.event_, PENDING_SUBSCRIPTION_ID); } else { + send_subscribe_ack(si.client_id_, si.service_id_, + si.instance_id_, si.eventgroup_id_, si.event_, PENDING_SUBSCRIPTION_ID); routing_manager_base::subscribe(si.client_id_, si.uid_, si.gid_, si.service_id_, si.instance_id_, si.eventgroup_id_, si.major_, si.event_); - send_subscribe_ack(si.client_id_, si.service_id_, - si.instance_id_, si.eventgroup_id_, si.event_, PENDING_SUBSCRIPTION_ID); #ifdef VSOMEIP_ENABLE_COMPAT send_pending_notify_ones(si.service_id_, si.instance_id_, si.eventgroup_id_, si.client_id_); diff --git a/interface/compat/vsomeip/constants.hpp b/interface/compat/vsomeip/constants.hpp index 2d14920..c91d037 100644 --- a/interface/compat/vsomeip/constants.hpp +++ b/interface/compat/vsomeip/constants.hpp @@ -19,7 +19,7 @@ const ttl_t DEFAULT_TTL = 0xFFFFFF; // "until next reboot" const std::string DEFAULT_MULTICAST = "224.0.0.0"; const uint16_t DEFAULT_PORT = 30500; -const uint16_t ILLEGAL_PORT = 0xFFFF; +const uint16_t ILLEGAL_PORT = 0; const uint16_t NO_TRACE_FILTER_EXPRESSION = 0x0000; diff --git a/interface/vsomeip/constants.hpp b/interface/vsomeip/constants.hpp index e46e0e7..3a8201a 100644 --- a/interface/vsomeip/constants.hpp +++ b/interface/vsomeip/constants.hpp @@ -19,7 +19,7 @@ const ttl_t DEFAULT_TTL = 0xFFFFFF; // "until next reboot" const std::string DEFAULT_MULTICAST = "224.0.0.0"; const uint16_t DEFAULT_PORT = 30500; -const uint16_t ILLEGAL_PORT = 0xFFFF; +const uint16_t ILLEGAL_PORT = 0; const uint16_t ANY_PORT = 0; const uint16_t NO_TRACE_FILTER_EXPRESSION = 0x0000; diff --git a/test/second_address_tests/conf/second_address_test_slave_starter.sh.in b/test/second_address_tests/conf/second_address_test_slave_starter.sh.in index 85080aa..8924163 100755 --- a/test/second_address_tests/conf/second_address_test_slave_starter.sh.in +++ b/test/second_address_tests/conf/second_address_test_slave_starter.sh.in @@ -19,7 +19,7 @@ OPERATIONMODE=$1 COMMUNICATIONMODE=$2 # Add second IP address to interface -ip addr add @TEST_IP_SLAVE_SECOND@ dev eth0 +ip addr add @TEST_IP_SLAVE_SECOND@/32 dev eth0 if [ "$OPERATIONMODE" = "CLIENT" ]; then SLAVE_APPLICATION=second_address_test_client @@ -54,7 +54,7 @@ kill $PID_VSOMEIPD sleep 1 # Delete second IP address -ip addr del @TEST_IP_SLAVE_SECOND@ dev eth0 +ip addr del @TEST_IP_SLAVE_SECOND@/32 dev eth0 # Check if everything went well exit $FAIL diff --git a/test/second_address_tests/second_address_test_globals.hpp b/test/second_address_tests/second_address_test_globals.hpp index 1909fcd..da5db1f 100644 --- a/test/second_address_tests/second_address_test_globals.hpp +++ b/test/second_address_tests/second_address_test_globals.hpp @@ -20,7 +20,7 @@ struct service_info { vsomeip::method_t shutdown_method_id; }; -struct service_info service = { 0x3333, 0x1, 0x1, 0x3301, 0x2, 0x3302, 0x1111, 0x2222, 0x1404 }; +struct service_info service = { 0x3333, 0x1, 0x1, 0x8301, 0x2, 0x8302, 0x1111, 0x2222, 0x1404 }; static constexpr std::uint32_t number_of_messages_to_send = 150; static constexpr std::uint8_t number_of_events_to_send = 150; |