Project

General

Profile

Actions

Bug #10577

open

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

Added by Rouven WEILER over 4 years ago. Updated about 4 years 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.

Actions #1

Updated by Toomas Soome over 4 years 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

Actions #2

Updated by Toomas Soome over 4 years ago

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

Actions #3

Updated by Toomas Soome over 4 years 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.

Actions #4

Updated by Rouven WEILER over 4 years 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.

Actions #5

Updated by Rouven WEILER over 4 years 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.

Actions #6

Updated by Toomas Soome over 4 years 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.

Actions #7

Updated by Rouven WEILER over 4 years 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)

Actions #8

Updated by Toomas Soome over 4 years 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).

Actions #9

Updated by Thomas Wagner about 4 years ago

Toomas Soome wrote:

Rouven WEILER wrote:

About "SRV" records. Domain Controllers are in my understanding not meant to be advertized primarily by mdns / avahi. This is done by regular DNS requests.

I would suggest that this is verified before this patch to advertize on with a false port number is itegrated.

In my setup a samba daemon actually serving SMB services (files, printers) does appear in the listing, see example below. (unpatched in this regard samba 4.10.8, from SFE repository)

root@hostname:/tmp# avahi-browse -a -r -p
+;net0;k.A.;HOSTNAME;_smb._tcp.;local.
=;net0;IPv4;HOSTNAME;Microsoft Windows Network;local;hostname.local.;192.168.111.111;445;

You see the real port number 445 here, but only when setting "-r" option to avahi-browse.

What is the actual problem to be solved with the suggested patch?

Actions #10

Updated by Thomas Wagner about 4 years ago

This Wiki Page describes a samba config setting to enable Icons in MacOS Finder:

https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X

Example from the mentioned Wiki page:
[Global]
min protocol = SMB2
vfs objects = catia fruit streams_xattr
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes

[TimeMachineBackup]
vfs objects = catia fruit streams_xattr
fruit:time machine = yes
  1. fruit:time machine max size = SIZE
Actions

Also available in: Atom PDF