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>
diff --git a/cast/standalone_receiver/main.cc b/cast/standalone_receiver/main.cc
index 6f6b051..1263f39 100644
--- a/cast/standalone_receiver/main.cc
+++ b/cast/standalone_receiver/main.cc
@@ -219,11 +219,15 @@
 
   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),