# mDNSResponder [Netatalk with zeroconf]



## marcel (Mar 13, 2014)

Hello Community,

I installed net/netatalk3 with mDNSResponder. Now I can only connect to the file server in Finder on my Mac with Go > Connect to Server and enter afp://[IP address]. So Bonjour/zeroconf is not working and I cannot find a solution in the internet.

/var/log/messages

```
Mar 12 10:53:41 FileServer syslogd: exiting on signal 15
Mar 12 10:53:47 FileServer syslogd: kernel boot file is /boot/kernel/kernel
Mar 12 10:53:47 FileServer mDNSResponder: mDNSResponder (Engineering Build) (Mar  9 2014 11:41:38) starting
Mar 12 10:53:47 FileServer mDNSResponder: mDNS_AddDNSServer: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)
Mar 12 10:53:47 FileServer mDNSResponder: mDNSResponder (Engineering Build) (Mar  9 2014 11:41:38) stopping
Mar 12 10:53:47 FileServer afpd: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
Mar 12 10:53:48 FileServer afpd: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
Mar 12 10:53:49 FileServer afpd: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
Mar 12 10:53:50 FileServer afpd: dnssd_clientstub ConnectToServer: connect() failed Socket:6 Err:-1 Errno:2 No such file or directory
```

/var/log/afpd.log

```
Mar 12 10:53:50.902977 afpd[4194] {afp_mdns.c:210} (E:AFPDaemon): Failed to add service: _afpovertcp._tcp, error=-65563
```

/etc/rc.conf

```
netatalk_enable="YES"
 cnid_metad_enable="YES"
 afpd_enable="YES"
 mdnsd_enable="YES"
 
mdnsresponder_enable="YES"
 mdnsresponder_flags="-f /usr/local/etc/mdnsresponder.conf"
```

/usr/local/etc/afp.conf

```
;
 ; Netatalk 3.x configuration file
 ;
 
 [Global]
 Global server settings
 hostname = FileServer
 mimic model = MacPro
 zeroconf = yes
 uam list = uams_dhx.so uams_dhx2.so
 afp listen = [IP adress]
 log level = default:warn
 log file = /var/log/afpd.log
 
 [Homes]
 basedir regex = /usr/home
 
 [TimeServer]
 path = /timeserver
 time machine = yes
```

/usr/local/etc/mdnsresponder.conf

```
"FileServer"   _afpovertcp._tcp.   local   548
```

Thanks in advance!


----------



## acheron (Mar 14, 2014)

What version of FreeBSD are you running? I'm using CURRENT and I also have problem with net/mDNSResponder. I have these error messages:
mDNSResponder (Engineering Build) (Mar  9 2014 11:41:38) starting
mDNSResponder: mDNS_AddDNSServer: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)
mDNSResponder: mDNS_AddDNSServer: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)
mDNSResponder: mDNSResponder (Engineering Build) (Mar  9 2014 11:41:38) stopping
[/code]
Switching to avahi for zeroconf solved this issue.


----------



## Peacekeeper2000 (Mar 16, 2014)

I am running FreeBSD 10-p0 and it works fine. 

I had two observations: The IP6 implementation of mDNSResponder looks like it has some trouble when IP6 is not fully configured. As I am only using IP4 at home, I have  compiled with 
	
	



```
HAVE_IPV6=0
```
 during make. This has also reduced the log file entries. Instead of the mDNSResponderPosix, I am now only starting 
	
	



```
mdnsd
```
 and it works fine with the old configuration file.

The second observation was, they DTrace was not working with Netatalk. Selecting that option has prevented compiling of Netatalk3 on my system ( AMD64 , generic)

BTW: When I upgraded to 10.0,  I had soem trouble to upgrade to DB46 as it is obsolete/ depreciated. While I had used the override, I found ut, that suddenly I had db46 and db5 installed. So I uninstalled db46 and used a  
	
	



```
dbd -f <afp_volumes>
```
 to scann and rebuild all CNID DB's. So i recommend to also check if you suddenly have two Barkley DB's installed or really use IP6 ( which I would disable )


----------



## kpa (Aug 15, 2014)

There's now an updated net/mDNSResponder and also a new port of dns/nss_mDNSResponder to hook up mDNS to nsswitch.conf(5). The first one seems to work now with IPv6 just fine. Time to ditch avahi for good.

Edit: The net/mDNSResponder port is version 544 from Jan 2014 with only some minor fixes afterwards, the other one dns/nss_mDNSResponder is the really new stuff that I have been waiting for so I can dump avahi forever.


----------



## Peacekeeper2000 (Aug 15, 2014)

Thanks for the post  :beer - I will have a look at it, need anyhow to update net/netatalk3 as the current version seems to have a memory leak  :\


----------



## obsigna (Aug 22, 2014)

kpa said:
			
		

> There's now an updated net/mDNSResponder and also a new port of dns/nss_mDNSResponder to hook up mDNS to nsswitch.conf(5). The first one seems to work now with IPv6 just fine. Time to ditch avahi for good.



After reading your post, I gave it another try on my setup, and it still throws a bunch of ipv6 related errors on startup (see below). I am on FreeBSD RELEASE-9.3. 
*Issue #1* is, that mDNSResponder addresses the members em0, em1 of a bridge interface bridge0.
*Issue #2* is, that it fails to register the exact IPv6 address of the bridge0 because it doesn't receive the correct net mask from the system.
*Issue #3* is, that it finds that the Addr and Ptr of server.local are already present somewhere in the system.

I fixed *Issue #1* by adding a new command-line option to mDNSResponderPosix:

```
Usage: mDNSResponderPosix [-v level ] [-r] [-n name] [-i iface] [-t type] [-d domain] [-p port] [-f file] [-b] [-P pidfile] [-x name=val ...]
...
          -i only binds to the interface 'iface'
...
```

With that the command `mDNSResponderPosix -i bridge0 -f /path/to/mDNSServices.conf` lets mDNSResponderPosix bind to the given interface only -- in this case my LAN interface bridge0, and therefore, it simply ignores em0,em1 as it ignores any other interface in the system. Another benefit of this is, that it ignores also the WAN interface from now on. I never liked it so much, that mDNSResponderPosix tries to announce the services over any possible channel to everybody in the world.

I fixed MY *Issue #2* by disabling the corresponding sanity check in mDNSCore/mDNS.c. This is of course not the correct solution, but I was not able to get to the source of the problem, since it seems that mDNSResponder receives the zero mask by a system call. However, for the time being this quick-fix allows the IPv6 address of bridge0 being correctly announced. The net mask isn't passed anyway into the mDNS records.

For *Issue #3*, I did not find a solution. Attached to this message is a patch file with the fixes for issues #1 and #2.  In order to apply said fixes, put this file into /usr/ports/net/mDNSResponder/files/, and re-install net/mDNSResponder. For re-moving the fixes, delete the patch file from /usr/ports/net/mDNSResponder/files/, and re-install and restart again:
`portmaster net/mDNSResponder`
`service mdnsresponderposix stop`
`service mdnsresponderposix start`

From /var/log/message when starting up mDNSResponderPosix:

```
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo FD7D:40EA:7B49:4A0B:0000:0000:0000:0001 with invalid mask «ZERO ADDRESS»
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C2FD60 server.local. (Addr) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C30180 99.51.47.102.in-addr.arpa. (PTR) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C31D60 server.local. (Addr) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C32180 1.0.168.192.in-addr.arpa. (PTR) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C33D60 server.local. (AAAA) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C34180 4.3.5.6.7.6.B.F.F.F.A.0.1.1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.E.F.ip6.arpa. (PTR) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C35D60 server.local. (AAAA) that's already in the list
Aug 21 20:14:59 server mDNSResponderPosix: mDNS_Register_internal: ERROR!! Tried to register AuthRecord 0000000800C36180 5.3.5.6.7.6.B.F.F.F.A.0.1.1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.E.F.ip6.arpa. (PTR) that's already in the list
Aug 21 20:15:00 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6534/em0/7
Aug 21 20:15:00 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6535/em1/8
Aug 21 20:15:00 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6534/em0/7
Aug 21 20:15:00 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6535/em1/8
Aug 21 20:15:00 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6534/em0/7
Aug 21 20:15:00 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6535/em1/8
Aug 21 20:15:01 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6534/em0/7
Aug 21 20:15:01 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6535/em1/8
Aug 21 20:15:02 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6534/em0/7
Aug 21 20:15:02 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6533/em1/8
Aug 21 20:15:04 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6534/em0/7
Aug 21 20:15:04 server mDNSResponderPosix: mDNSPlatformSendUDP got error 50 (Network is down) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:0211:0AFF:FB67:6535/em1/8
```


----------



## Peacekeeper2000 (Aug 22, 2014)

I also have a bridge interface on my MacBook. I think the bridge interface is a bit more complex as it is built to bridge two networks. So inside of the bridge you have member interfaces that point to the real interface. Also have a look under BSD Handbook Chapter 32.6.3 So I would recommend to assign it to a real physical interface instead of the bridge.

I assume that mDNSResponderPosix is not prepared to handle a bridge as this was also a new interface after I upgraded my MAC OSX (which uses BSD as a foundation) - need to look if the source on the Apple site has not been updated, but not been ported yet (will check and come back).

The third issue seems to be a cashing issue - FF02:0000:0000:0000:0000:0000:0000:00FB is under IPv6 a special address to identify ".local" names which is used through UDP port 5353. All receiving addresses FE80::/10 are link-local addresses. So IPv6 might be not fully configured in your environment or just as link-local only. 

As said, I had the same issues with IPv6 - now I complied it without IPv6 as I anyhow only use it in my "homelan"


----------

