How to make mDNSResponder to resolve local domain names?

I installed mDNSResponder from port.

Code:
cd /usr/ports
portmaster net/mDNSResponder
echo 'mdnsd_enable="YES"' >> /etc/rc.conf
service mdnsd restart

After that, I modified /etc/nsswitch.conf to add mdns to host: entry.

It works well. My OSX box can find FreeBSD box via name. But, FreeBSD box cannot find OSX box with name. It also cannot find other FreeBSD box too. I think there's some problem on resolving name to IP address feature.


Code:
root@freebsd9:~ # mDNSIdentify freebsd9.local
freebsd9.local. Addr 192.168.0.105
freebsd9.local has no HINFO record
mDNS_PurgeCacheResourceRecord: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)
mDNS_PurgeCacheResourceRecord: Lock not held! mDNS_busy (0) mDNS_reentrancy (0)

^Croot@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
curl: (6) Could not resolve host: freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://freebsd9.local
root@freebsd9:~ # curl http://localhost
curl: (7) Failed connect to localhost:80; Connection refused
root@freebsd9:~ #


So, name advertising is working well, but name resolution doesn't work.
How can make it to work?
 
OP
eonil
That solved the issue. Thanks.

Anyway, nss_mdns has a hard dependency on Avahi, so it installs Avahi. I chose mDNSResponder to avoid the heavy dependencies of Avahi, so actually this avoids my intention :(

So I decided just to go Avahi.
 
OP
eonil
Oh looks nice.

Anyway, I am not currently on the mDNS stuff, so currently I can't test it.
But if I get another chance I will try it.

Thanks for information.
 
@Mazhe, you have to support staging in your new port to have it accepted to the ports tree, the attached patch should do the job. It modifies the Makefile and the pkg-plist files.
 

Attachments

  • dns-mDNSResponder_nss-stage.diff.txt
    1.4 KB · Views: 185
Last edited by a moderator:
kpa said:
@Mazhe, you have to support staging in your new port to have it accepted to the ports tree, the attached patch should do the job. It modifies the Makefile and the pkg-plist files.

Thanks, people wanting to try the last version can do so: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/178052&getpatch=4

But yet there's a problem inside of mDNSResponder which makes every query answer be 0.0.0.0 or ::0 (when network frames seems to be OK). It is even not FreeBSD-specific as it happens under also under GNU/Linux, so...
 
Last edited by a moderator:
Top