]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add version-based visibility of shairport-sync endpoints 1831/head
authorOleh Kuzhylnyi <kuzhylol@gmail.com>
Sun, 24 Mar 2024 16:05:40 +0000 (13:05 -0300)
committerOleh Kuzhylnyi <kuzhylol@gmail.com>
Tue, 26 Mar 2024 22:48:42 +0000 (19:48 -0300)
This patch introduces modification to AirPlay attributes allowing AirPlay clients
seeing only appropriate Endpoints of specific version of AirPlay protocol.

[Test]
Run two instances of shairport-sync - built for version 1 and for version 2.

TuneBlade recognizes only AirPlay version 1 instance running.
MacOS/iOS recognizes only AirPlay version 2 instance running.

Without that patch, both MacOS/iOS detect two endpoints at the same time.
The TuneBlade detects only AirPlay version 1 since it doesn't support AirPlay version 2.

mdns.h
rtsp.c

diff --git a/mdns.h b/mdns.h
index f69179efebb942990f2826f8ca4a3c452bdccbd1..e81fda487757ea2fc692f37f69793f16c8315e91 100644 (file)
--- a/mdns.h
+++ b/mdns.h
@@ -33,12 +33,12 @@ typedef struct {
 
 /*
  #define MDNS_RECORD_WITH_METADATA \
-  "tp=UDP", "sm=false", "ek=1", "et=0,1", "cn=0,1", "ch=2", METADATA_EXPRESSION, "ss=16",          \
+  "tp=UDP", "sm=false", "ek=1", "et=0,1", "ch=2", METADATA_EXPRESSION, "ss=16",                    \
       "sr=44100", "vn=3", "txtvers=1", config.password ? "pw=true" : "pw=false"
 */
 #define MDNS_RECORD_WITH_METADATA                                                                  \
   "sf=0x4", "fv=76400.10", "am=ShairportSync", "vs=105.1", "tp=TCP,UDP", "vn=65537",               \
-      METADATA_EXPRESSION, "ss=16", "sr=44100", "da=true", "sv=false", "et=0,1", "ek=1", "cn=0,1", \
+      METADATA_EXPRESSION, "ss=16", "sr=44100", "da=true", "sv=false", "et=0,1", "ek=1", \
       "ch=2", "txtvers=1", config.password ? "pw=true" : "pw=false"
 
 #endif
@@ -52,7 +52,7 @@ typedef struct {
 
 #define MDNS_RECORD_WITHOUT_METADATA                                                               \
   "sf=0x4", "fv=76400.10", "am=ShairportSync", "vs=105.1", "tp=TCP,UDP", "vn=65537", "ss=16",      \
-      "sr=44100", "da=true", "sv=false", "et=0,1", "ek=1", "cn=0,1", "ch=2", "txtvers=1",          \
+      "sr=44100", "da=true", "sv=false", "et=0,1", "ek=1", "ch=2", "txtvers=1",                    \
       config.password ? "pw=true" : "pw=false"
 
 #endif // _MDNS_H
diff --git a/rtsp.c b/rtsp.c
index 26883471d3785e2da35fb493a5cdce5a656011d8..e22edb8f44b846f2b490fa6cc50ecc1645ec21f5 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -272,7 +272,6 @@ void build_bonjour_strings(__attribute((unused)) rtsp_conn_info *conn) {
   pkString_make(pkString + strlen("pk="), sizeof(pkString) - strlen("pk="),
                 config.airplay_device_id);
 
-  txt_records[entry_number++] = "cn=0,1";
   txt_records[entry_number++] = "da=true";
   txt_records[entry_number++] = "et=0,1";
   txt_records[entry_number++] = ap1_featuresString;
@@ -311,7 +310,6 @@ void build_bonjour_strings(__attribute((unused)) rtsp_conn_info *conn) {
   txt_records[entry_number++] = "sv=false";
   txt_records[entry_number++] = "et=0,1";
   txt_records[entry_number++] = "ek=1";
-  txt_records[entry_number++] = "cn=0,1";
   txt_records[entry_number++] = "ch=2";
   txt_records[entry_number++] = "txtvers=1";
   if (config.password == 0)