COVESA / vsomeip

An implementation of Scalable service-Oriented MiddlewarE over IP
Mozilla Public License 2.0
1.02k stars 651 forks source link

Multiple routing managers in single process don't work #603

Open zhaoxin39913 opened 5 months ago

zhaoxin39913 commented 5 months ago

Hi COVESA team,

We have an user secnario to run multiple routing managers within a single process, however according to our test result this feature is not fully supported in latest version V3.4.9-r1because of the issue https://github.com/COVESA/vsomeip/issues/540 . It would be appreciated if you can let us know when this feature can be fully supported , or how to fix the issue we found. Thanks.

zhaoxin39913 commented 4 months ago

Hi COVESA team,

This issue is getting fixed by commenting out below code (between "#if 0" and "endif") in below function in service_discovery_impl.cpp. Could you please check if the change is reasonable or not?

bool service_discovery_impl::check_ipv4_address(
        const boost::asio::ip::address& its_address) const {
    //Check unallowed ipv4 address
    bool is_valid = true;

    static const boost::asio::ip::address_v4::bytes_type its_unicast_address =
            unicast_.to_v4().to_bytes();
    const boost::asio::ip::address_v4::bytes_type endpoint_address =
            its_address.to_v4().to_bytes();
#if 0
    static const boost::asio::ip::address_v4::bytes_type its_netmask =
            configuration_->get_netmask().to_v4().to_bytes();
#endif
    //same address as unicast address of DUT not allowed
    if (its_unicast_address == endpoint_address) {
        VSOMEIP_ERROR << "Subscriber's IP address is same as host's address! : "
                << its_address;
        is_valid = false;
    } else {
#if 0
        const std::uint32_t self = VSOMEIP_BYTES_TO_LONG(its_unicast_address[0],
                its_unicast_address[1], its_unicast_address[2], its_unicast_address[3]);
        const std::uint32_t remote = VSOMEIP_BYTES_TO_LONG(endpoint_address[0],
                endpoint_address[1], endpoint_address[2], endpoint_address[3]);
        const std::uint32_t netmask = VSOMEIP_BYTES_TO_LONG(its_netmask[0],
                its_netmask[1], its_netmask[2], its_netmask[3]);
        if ((self & netmask) != (remote & netmask)) {
            VSOMEIP_ERROR<< "Subscriber's IP isn't in the same subnet as host's IP: "
                    << its_address;
            is_valid = false;
        }
#endif
    }
    return is_valid;
}