<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Spotify Connect not working when localhost resolves to more than one address in Android</title>
    <link>https://community.spotify.com/t5/Android/Spotify-Connect-not-working-when-localhost-resolves-to-more-than/m-p/4645082#M144487</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Galaxy S7 running LineageOS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Android 7 Nougat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;On my Android device, Spotify sends the mDNS broadcasts over the lo interface due to the following bug in the Spotify mDNS implementation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, the system's hostname is retrieved with &lt;FONT face="courier new,courier"&gt;boost::asio::ip::host_name&lt;/FONT&gt;. That hostname is looked up using &lt;FONT face="courier new,courier"&gt;boost::asio::ip::udp:resolver::resolve&lt;/FONT&gt;, and then, if more than one hostname is returned, the mDNS broadcast socket is bound to any found IPv4 addresses using &lt;FONT face="courier new,courier"&gt;boost::asio::ip::udp::socket::set_option(boost::asio::ip::multicast::outbound_interface)&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On my system, and many others (see &lt;A href="https://github.com/AdAway/AdAway/issues/1009" target="_blank"&gt;https://github.com/AdAway/AdAway/issues/1009&lt;/A&gt; and &lt;A href="https://github.com/StevenBlack/hosts/issues/619" target="_blank"&gt;https://github.com/StevenBlack/hosts/issues/619&lt;/A&gt;), the gethostname call returns localhost, and localhost resolves to 127.0.0.1 as well as ::1 due to corresponding default entries in /system/etc/hosts. This will cause the socket to bind to 127.0.0.1 and therefore the mDNS broadcast requests are sent over lo instead of wlan0, never reaching the intended targets. I can reproduce the issue by adding and removing the line "::1 localhost" from /system/etc/hosts, and I will see the udp port 5353 packets on wlan0 or lo, respectively.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jan 2019 22:39:56 GMT</pubDate>
    <dc:creator>kbraden</dc:creator>
    <dc:date>2019-01-03T22:39:56Z</dc:date>
    <item>
      <title>Spotify Connect not working when localhost resolves to more than one address</title>
      <link>https://community.spotify.com/t5/Android/Spotify-Connect-not-working-when-localhost-resolves-to-more-than/m-p/4645082#M144487</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Galaxy S7 running LineageOS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Android 7 Nougat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;On my Android device, Spotify sends the mDNS broadcasts over the lo interface due to the following bug in the Spotify mDNS implementation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, the system's hostname is retrieved with &lt;FONT face="courier new,courier"&gt;boost::asio::ip::host_name&lt;/FONT&gt;. That hostname is looked up using &lt;FONT face="courier new,courier"&gt;boost::asio::ip::udp:resolver::resolve&lt;/FONT&gt;, and then, if more than one hostname is returned, the mDNS broadcast socket is bound to any found IPv4 addresses using &lt;FONT face="courier new,courier"&gt;boost::asio::ip::udp::socket::set_option(boost::asio::ip::multicast::outbound_interface)&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On my system, and many others (see &lt;A href="https://github.com/AdAway/AdAway/issues/1009" target="_blank"&gt;https://github.com/AdAway/AdAway/issues/1009&lt;/A&gt; and &lt;A href="https://github.com/StevenBlack/hosts/issues/619" target="_blank"&gt;https://github.com/StevenBlack/hosts/issues/619&lt;/A&gt;), the gethostname call returns localhost, and localhost resolves to 127.0.0.1 as well as ::1 due to corresponding default entries in /system/etc/hosts. This will cause the socket to bind to 127.0.0.1 and therefore the mDNS broadcast requests are sent over lo instead of wlan0, never reaching the intended targets. I can reproduce the issue by adding and removing the line "::1 localhost" from /system/etc/hosts, and I will see the udp port 5353 packets on wlan0 or lo, respectively.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 22:39:56 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Android/Spotify-Connect-not-working-when-localhost-resolves-to-more-than/m-p/4645082#M144487</guid>
      <dc:creator>kbraden</dc:creator>
      <dc:date>2019-01-03T22:39:56Z</dc:date>
    </item>
  </channel>
</rss>

