From 65493d09e89e73e32ea348bbfb9b4e90e23794ca Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 10 Feb 2024 00:23:15 -0600 Subject: [PATCH] Cloak MAC address from unpaired clients --- src/nvhttp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nvhttp.cpp b/src/nvhttp.cpp index 312c68fcb7a..af211c579b7 100644 --- a/src/nvhttp.cpp +++ b/src/nvhttp.cpp @@ -660,9 +660,17 @@ namespace nvhttp { tree.put("root.uniqueid", http::unique_id); tree.put("root.HttpsPort", net::map_port(PORT_HTTPS)); tree.put("root.ExternalPort", net::map_port(PORT_HTTP)); - tree.put("root.mac", platf::get_mac_address(net::addr_to_normalized_string(local_endpoint.address()))); tree.put("root.MaxLumaPixelsHEVC", video::active_hevc_mode > 1 ? "1869449984" : "0"); + // Only include the MAC address for requests sent from paired clients over HTTPS. + // For HTTP requests, use a placeholder MAC address that Moonlight knows to ignore. + if constexpr (std::is_same_v) { + tree.put("root.mac", platf::get_mac_address(net::addr_to_normalized_string(local_endpoint.address()))); + } + else { + tree.put("root.mac", "00:00:00:00:00:00"); + } + // Moonlight clients track LAN IPv6 addresses separately from LocalIP which is expected to // always be an IPv4 address. If we return that same IPv6 address here, it will clobber the // stored LAN IPv4 address. To avoid this, we need to return an IPv4 address in this field