Project

General

Profile

Bug #10577

avahi/dns-sd not propagating services using port "0"

Added by Rouven WEILER 5 months ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Assignee:
Category:
OI-Userland
Target version:
-
Start date:
2019-03-21
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

There is an issue when trying to propagate mdns entries that include port "0".

Trying to propagate "dns-sd -R hostname._device-info._tcp local 0 model=RackMac" for sending an icon to MacOS Finder does not work and is not listet in avahi-browse -a.
The same issue appears when trying that with "dns-sd -R hostname._adisk._tcp local 0 sys=waMA=b4:99:ba:bf:46:4e,adVF=0x100 dk0=adVF=0x83,adVN=Time Machine".

Using port "9" makes it work, e.g. "dns-sd -R hostname._adisk._tcp local 0 sys=waMA=b4:99:ba:bf:46:4e,adVF=0x100 dk0=adVF=0x83,adVN=Time Machine".

This issue also takles samba avahi-registration for the same services _device-info and _adisk. I has already been send to samba-technical (https://lists.samba.org/archive/samba-technical/2019-March/132994.html) but there is no feedback yet.

History

#1

Updated by Toomas Soome 5 months ago

Rouven WEILER wrote:

There is an issue when trying to propagate mdns entries that include port "0".

Trying to propagate "dns-sd -R hostname._device-info._tcp local 0 model=RackMac" for sending an icon to MacOS Finder does not work and is not listet in avahi-browse -a.
The same issue appears when trying that with "dns-sd -R hostname._adisk._tcp local 0 sys=waMA=b4:99:ba:bf:46:4e,adVF=0x100 dk0=adVF=0x83,adVN=Time Machine".

Using port "9" makes it work, e.g. "dns-sd -R hostname._adisk._tcp local 0 sys=waMA=b4:99:ba:bf:46:4e,adVF=0x100 dk0=adVF=0x83,adVN=Time Machine".

This issue also takles samba avahi-registration for the same services _device-info and _adisk. I has already been send to samba-technical (https://lists.samba.org/archive/samba-technical/2019-March/132994.html) but there is no feedback yet.

from manual:
dns-sd [-R name type domain port [key=value ...]]

dns-sd R beastie _device-info._tcp local 0 model=RackMac
Registering Service beastie._device-info._tcp.local port 0 TXT model=RackMac
DATE: ---Thu 21 Mar 2019--

10:19:31.243 ...STARTING...
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.info] set_peer_pid: Not Supported on this version of OS
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.warning] 15: connect_callback: Adding FD for uid 0
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.warning] 15: DNSServiceRegister(0, 0, "beastie", "_device-info._tcp", "local", "", 0) START PID[-1]()
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.info] mDNS_Register_internal: Adding to duplicate list 21 beastie._device-info._tcp.local. SRV 0 0 0 beastie.local.
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.info] IncrementAutoTargetServices: AutoTargetServices 4 Record 21 beastie._device-info._tcp.local. SRV 0 0 0 beastie.local.
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.warning] 15: DNSServiceRegister(beastie._device-info._tcp.local., 0) ADDED
10:19:31.483 Got a reply for service beastie._device-info._tcp.local.: Name now registered and active
Mar 21 10:19:31 beastie mDNSResponder: [ID 702911 daemon.warning] 15: DNSServiceRegister(beastie._device-info._tcp.local., 0) REGISTERED

#2

Updated by Toomas Soome 5 months ago

in this case, you need to separate host name, service type, domain and port.

#3

Updated by Toomas Soome 5 months ago

Toomas Soome wrote:

in this case, you need to separate host name, service type, domain and port.

And yet, you are correct, there is a bug - for _device-info, port 0 is not registered correctly, with port != 0, the registered name appears in browse list and will resolve.

#4

Updated by Rouven WEILER 5 months ago

Toomas Soome wrote:

in this case, you need to separate host name, service type, domain and port.

Sorry for that. Of course I tried a "working" output.

#5

Updated by Rouven WEILER 5 months ago

Toomas Soome wrote:

Toomas Soome wrote:

in this case, you need to separate host name, service type, domain and port.

And yet, you are correct, there is a bug - for _device-info, port 0 is not registered correctly, with port != 0, the registered name appears in browse list and will resolve.

Okay, thanks for looking into this.
Do you consider that a bug?
For me it appears to be an issue in avahi as avahi_register.c (https://github.com/samba-team/samba/blob/25f2fe02a615e2cf906b6fa495acd8ea0aa9998a/source3/smbd/avahi_register.c#L186) of samba seems to do that same thing as you did by dns-sd.

#6

Updated by Toomas Soome 5 months ago

Rouven WEILER wrote:

Toomas Soome wrote:

Toomas Soome wrote:

in this case, you need to separate host name, service type, domain and port.

And yet, you are correct, there is a bug - for _device-info, port 0 is not registered correctly, with port != 0, the registered name appears in browse list and will resolve.

Okay, thanks for looking into this.
Do you consider that a bug?
For me it appears to be an issue in avahi as avahi_register.c (https://github.com/samba-team/samba/blob/25f2fe02a615e2cf906b6fa495acd8ea0aa9998a/source3/smbd/avahi_register.c#L186) of samba seems to do that same thing as you did by dns-sd.

There is this problem now - the mDNSResponder package (dns-sd cient binary + mdnsd from Apple), is never built to support updating the device-info record like that.

The service registration always is assuming port number > 0 to create service announcement and port == 0 case is to exclude this port from service announcement. The service in this context means that we will get SRV record for it.

The _device-info is not normal service, it only will get TXT record to provide textual information about the device, and the record setup is not implemented for non-OSX. The setup of _device-info TXT record is done as part of the mdnsd initialization and it is not meant to be updated via service registration.

#7

Updated by Rouven WEILER 5 months ago

Toomas Soome wrote:

Rouven WEILER wrote:

Toomas Soome wrote:

Toomas Soome wrote:

in this case, you need to separate host name, service type, domain and port.

And yet, you are correct, there is a bug - for _device-info, port 0 is not registered correctly, with port != 0, the registered name appears in browse list and will resolve.

Okay, thanks for looking into this.
Do you consider that a bug?
For me it appears to be an issue in avahi as avahi_register.c (https://github.com/samba-team/samba/blob/25f2fe02a615e2cf906b6fa495acd8ea0aa9998a/source3/smbd/avahi_register.c#L186) of samba seems to do that same thing as you did by dns-sd.

There is this problem now - the mDNSResponder package (dns-sd cient binary + mdnsd from Apple), is never built to support updating the device-info record like that.

The service registration always is assuming port number > 0 to create service announcement and port == 0 case is to exclude this port from service announcement. The service in this context means that we will get SRV record for it.

The _device-info is not normal service, it only will get TXT record to provide textual information about the device, and the record setup is not implemented for non-OSX. The setup of _device-info TXT record is done as part of the mdnsd initialization and it is not meant to be updated via service registration.

That all sounds reasonable and is in line with IANA specs. There is just one puzzling thing: Why is it working for you doing the announcement via avahi and why not for samba doing it also via avahi???

Anyway: Does it then make sense to bind both to the port "9"? I would forward this issue link to the samba devs after we are done ;o)

#8

Updated by Toomas Soome 5 months ago

Rouven WEILER wrote:

Toomas Soome wrote:

Rouven WEILER wrote:

Toomas Soome wrote:

Toomas Soome wrote:

in this case, you need to separate host name, service type, domain and port.

And yet, you are correct, there is a bug - for _device-info, port 0 is not registered correctly, with port != 0, the registered name appears in browse list and will resolve.

Okay, thanks for looking into this.
Do you consider that a bug?
For me it appears to be an issue in avahi as avahi_register.c (https://github.com/samba-team/samba/blob/25f2fe02a615e2cf906b6fa495acd8ea0aa9998a/source3/smbd/avahi_register.c#L186) of samba seems to do that same thing as you did by dns-sd.

There is this problem now - the mDNSResponder package (dns-sd cient binary + mdnsd from Apple), is never built to support updating the device-info record like that.

The service registration always is assuming port number > 0 to create service announcement and port 0 case is to exclude this port from service announcement. The service in this context means that we will get SRV record for it.

The _device-info is not normal service, it only will get TXT record to provide textual information about the device, and the record setup is not implemented for non-OSX. The setup of _device-info TXT record is done as part of the mdnsd initialization and it is not meant to be updated via service registration.

That all sounds reasonable and is in line with IANA specs. There is just one puzzling thing: Why is it working for you doing the announcement via avahi and why not for samba doing it also via avahi???

Anyway: Does it then make sense to bind both to the port "9"? I would forward this issue link to the samba devs after we are done ;o)

My avahi registration was passed, but it did not appear for client before I did change port to 1 (or anything other than 0 for that matter). I think the same does happen with samba - you can debug this by pkill -USR1 mdnsd and then watch the daemon syslog.

Note this has nothing to do about which client is sending the registration record, the mdnsd does check if port 0, thats it.

if you will manually register _device-info with port > 0, you you will get SRV record for _device-info, but since noone will use such SRV record, it is harmless (except it is noise).

Also available in: Atom PDF