aboutsummaryrefslogtreecommitdiff
path: root/cast
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2021-02-04 01:08:58 -0800
committerCommit Bot <commit-bot@chromium.org>2021-02-05 22:54:01 +0000
commitb98dcaa0db83132203774a577c0a64c39f7092e9 (patch)
treea2fbd7d9c584ef58d636bc588011a5473aaec2eb /cast
parente088a051f43101e69819127471fa822afb7c82f4 (diff)
downloadopenscreen-b98dcaa0db83132203774a577c0a64c39f7092e9.tar.gz
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 <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast')
-rw-r--r--cast/common/discovery/e2e_test/tests.cc17
1 files changed, 9 insertions, 8 deletions
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 <map>
#include <string>
+// 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<InterfaceInfo> 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 {