From b98dcaa0db83132203774a577c0a64c39f7092e9 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Thu, 4 Feb 2021 01:08:58 -0800 Subject: Update mDNS service binding This is a followup patch to: https://chromium-review.googlesource.com/c/openscreen/+/2643397 To make it RFC compliant, we now send to the multicast group address, not to ANY. We also bind to ANY address instead of the local address of the interface, since binding filters multicast traffic to only bound addresses. Joining the multicast group is what filters the traffic instead. Bug: b/178102949 Change-Id: I1d7e44b5e90d2f1f1d395cb9a8a689edf16bfafb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2665304 Reviewed-by: Ryan Keane Commit-Queue: Jordan Bayles --- cast/common/discovery/e2e_test/tests.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'cast') diff --git a/cast/common/discovery/e2e_test/tests.cc b/cast/common/discovery/e2e_test/tests.cc index f39c39d5..9a02053b 100644 --- a/cast/common/discovery/e2e_test/tests.cc +++ b/cast/common/discovery/e2e_test/tests.cc @@ -7,6 +7,10 @@ #include #include +// NOTE: although we use gtest here, prefer OSP_CHECKs to +// ASSERTS due to asynchronous concerns around test failures. +// Although this causes the entire test binary to fail instead of +// just a single test, it makes debugging easier/possible. #include "cast/common/public/service_info.h" #include "discovery/common/config.h" #include "discovery/common/reporting_client.h" @@ -118,22 +122,19 @@ class FailOnErrorReporting : public discovery::ReportingClient { }; discovery::Config GetConfigSettings() { - discovery::Config config; - // Get the loopback interface to run on. - absl::optional loopback = GetLoopbackInterfaceForTesting(); - OSP_CHECK(loopback.has_value()); + InterfaceInfo loopback = GetLoopbackInterfaceForTesting().value(); + OSP_LOG_INFO << "Selected network interface for testing: " << loopback; discovery::Config::NetworkInfo::AddressFamilies address_families = discovery::Config::NetworkInfo::kNoAddressFamily; - if (loopback->GetIpAddressV4()) { + if (loopback.GetIpAddressV4()) { address_families |= discovery::Config::NetworkInfo::kUseIpV4; } - if (loopback->GetIpAddressV6()) { + if (loopback.GetIpAddressV6()) { address_families |= discovery::Config::NetworkInfo::kUseIpV6; } - config.network_info.push_back({loopback.value(), address_families}); - return config; + return discovery::Config{{{std::move(loopback), address_families}}}; } class DiscoveryE2ETest : public testing::Test { -- cgit v1.2.3