aboutsummaryrefslogtreecommitdiff
path: root/cast
diff options
context:
space:
mode:
authorYuri Wiitala <miu@chromium.org>2020-11-20 07:36:03 -0800
committerCommit Bot <commit-bot@chromium.org>2020-11-20 17:57:59 +0000
commit8dae1eb937cba58791c16a9caaa723676de563a1 (patch)
treeca201b8ab663a47513080c9735a77c53cdd48792 /cast
parente1193a50d55fd11325862c0732c347779b426c63 (diff)
downloadopenscreen-8dae1eb937cba58791c16a9caaa723676de563a1.tar.gz
Allow Cast Standalone Receiver to bind to loopback device.
It's often useful for development to run the standalone receiver on the loopback interface, to prevent spurious traffic on the LAN. This patch allows its use, but includes a check that will disable discovery. Bug: b/162542369 Change-Id: I574dafbddd60869324623e4ada9aabf501226b9d Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2552437 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast')
-rw-r--r--cast/standalone_receiver/main.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/cast/standalone_receiver/main.cc b/cast/standalone_receiver/main.cc
index 6f6b051d..1263f39c 100644
--- a/cast/standalone_receiver/main.cc
+++ b/cast/standalone_receiver/main.cc
@@ -219,11 +219,15 @@ int RunStandaloneReceiver(int argc, char* argv[]) {
const InterfaceInfo interface = GetInterfaceInfoFromName(interface_name);
OSP_CHECK(interface.GetIpAddressV4() || interface.GetIpAddressV6());
- OSP_CHECK(std::any_of(interface.hardware_address.begin(),
- interface.hardware_address.end(),
- [](int e) { return e > 0; }))
- << "Hardware address is empty. Either you are on a loopback device "
- "or getting the network interface information failed somehow.";
+ if (std::all_of(interface.hardware_address.begin(),
+ interface.hardware_address.end(),
+ [](int e) { return e == 0; })) {
+ OSP_LOG_WARN
+ << "Hardware address is empty. Either you are on a loopback device "
+ "or getting the network interface information failed somehow. "
+ "Discovery publishing will be disabled.";
+ discovery_enabled = false;
+ }
auto* const task_runner = new TaskRunnerImpl(&Clock::now);
PlatformClientPosix::Create(milliseconds(50), milliseconds(50),