Git Product home page Git Product logo

nss-mdns's Introduction

AVAHI SERVICE DISCOVERY SUITE

Avahi is a free, LGPL implementation of DNS Service Discovery (DNS-SD RFC 6763) over Multicast DNS (mDNS RFC 6762),
commonly known as and compatible with Apple Bonjour primarily targeting Linux.

Copyright 2004-2022 by the Avahi developers.

BUGS:
	https://github.com/avahi/avahi

WEB SITE:
	https://avahi.org/

GIT:
	https://github.com/avahi/avahi.git

MAILING LIST:
	https://lists.freedesktop.org/mailman/listinfo/avahi

COVERITY SCAN REPORT:
	https://scan.coverity.com/projects/avahi-daemon

OSS-FUZZ REPORT:
	https://introspector.oss-fuzz.com/project-profile?project=avahi

COVERAGE REPORT:
	https://coveralls.io/github/avahi/avahi

CODESPELL REPORT:
	https://fossies.org/linux/test/avahi-master.tar.gz/codespell.html

AUTHORS:
	Lennart Poettering
	Trent Lloyd

nss-mdns's People

Contributors

agoode avatar dgtlrift avatar kuroneko avatar mgorny avatar ntninja avatar pemensik avatar poettering avatar valpackett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nss-mdns's Issues

Revisit MDNS_MINIMAL reverse lookup

It is not clear why only minimal mode has this:
/* Only query for 169.254.0.0/16 IPv4 in minimal mode */

Is it something we can remove? I don't know what harm there is in handling more reverse queries. Probably a latency issue?

mdns failng with current versions of libnss-mdns and avahi-daemon

Originally reported at https://bugs.launchpad.net/ubuntu/+source/avahi/+bug/2021409

I have Ubuntu Server 22.04.2 running in a VM (VMWare 13.0.2) on an Apple Silicon Mac running macOS 13.4.

I have installed avahi-daemon and libnss-mdns, but mdns resolution is not occurring over my primary network interface:

Note that this is with allow-interfaces=ens160 set /etc/avahi/avahi-daemon.conf.

(22:25:17 Sat May 27 2023 jeremy@cid pts/0 aarch64)
[648] ~ $ sudo resolvectl mdns ens160 1

(22:25:22 Sat May 27 2023 jeremy@cid pts/0 aarch64)
[649] ~ $ resolvectl status
Global
       Protocols: -LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (ens160)
    Current Scopes: DNS mDNS/IPv4 mDNS/IPv6
         Protocols: +DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 2601:647:6680:4b95::1
       DNS Servers: 10.1.30.1 2601:647:6680:4b95::1
        DNS Domain: localdomain

(22:25:27 Sat May 27 2023 jeremy@cid pts/0 aarch64)
[650] ~ $ avahi-resolve -n cid.local
Failed to resolve host name 'cid.local': Timeout reached

(22:26:03 Sat May 27 2023 jeremy@cid pts/0 aarch64)
[651] ~ $ avahi-resolve -a 10.0.30.1
Failed to resolve address '10.0.30.1': Timeout reached

(22:26:13 Sat May 27 2023 jeremy@cid pts/0 aarch64)
[652] ~ $ sudo systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-05-27 22:22:29 UTC; 3min 51s ago
TriggeredBy: ● avahi-daemon.socket
   Main PID: 850 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."
      Tasks: 2 (limit: 4523)
     Memory: 1.5M
        CPU: 15ms
     CGroup: /system.slice/avahi-daemon.service
             ├─850 "avahi-daemon: running [cid.local]"
             └─891 "avahi-daemon: chroot helper"

May 27 22:22:29 cid avahi-daemon[850]: No service file found in /etc/avahi/services.
May 27 22:22:29 cid avahi-daemon[850]: Joining mDNS multicast group on interface ens160.IPv6 with address 2601:647:6680:4b95:20c:29ff:fe42:f399.
May 27 22:22:29 cid avahi-daemon[850]: New relevant interface ens160.IPv6 for mDNS.
May 27 22:22:29 cid avahi-daemon[850]: Joining mDNS multicast group on interface ens160.IPv4 with address 10.1.30.2.
May 27 22:22:29 cid avahi-daemon[850]: New relevant interface ens160.IPv4 for mDNS.
May 27 22:22:29 cid avahi-daemon[850]: Network interface enumeration completed.
May 27 22:22:29 cid avahi-daemon[850]: Registering new address record for 2601:647:6680:4b95:20c:29ff:fe42:f399 on ens160.*.
May 27 22:22:29 cid avahi-daemon[850]: Registering new address record for 10.1.30.2 on ens160.IPv4.
May 27 22:22:30 cid avahi-daemon[850]: Server startup complete. Host name is cid.local. Local service cookie is 2371061072.
May 27 22:26:11 cid avahi-daemon[850]: wide-area.c: Query timed out.

(22:27:14 Sat May 27 2023 jeremy@cid pts/0 aarch64)
[657] ~ $ grep hosts /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns

If I set 'allow-interfaces=ens160,lo`, we are able to resolve cid.local to localhost:

$ avahi-resolve -n cid.local
cid.local 127.0.0.1

but I cannot lookup anything else on my network via the ens160 interface.

I can resolve cid.local (10.1.30.2) from other devices on my network for a brief moment after I restart avahi-daemon.

[659] /etc/avahi/services $ avahi-browse -a
+ lo IPv4 cid SSH Remote Terminal local
+ lo IPv4 cid SFTP File Transfer local

It's as if something is causing the network interface to not support mdns, but everyhing looks configured to me... what am I missing? It should really not be this difficult...

Please update/clarify/justify recommendations for IPv4-only vs. any-protocol

The Debian package for nss-mdns gets occasional requests to enable mdns{_minimal,} instead of mdns4{_minimal,} by default. It isn't clear that obeying those requests would actually be a good thing, but it would be useful for the recommendations and their reasons to be written down in the upstream documentation, where they can be updated in-place if the facts change.

I'll reply to this issue report with my understanding of the situation.

Broken subdomain resolution (eg. sub.domain.local)

Hey there! First things first: thanks for maintaining the nss-mdns extension!

I found a regression between 0.10 and 0.14.1 regarding the subdomain resolution.
Unfortunately, I was affected by an Arch Linux package upgrade which directly upgraded
0.10-7 to 0.14.1-1 (x86_64), so I cannot bisect the initial broken version right now.

The issue happens only on subdomains, not regular domains. (test.local resolves properly,
while sub.test.local does not) Here comes a little demo session:

$ pacman -Q nss-mdns
nss-mdns 0.10-7

$ avahi-resolve -n sub.test.local
sub.test.local	172.17.0.14

$ ping -c1 sub.test.local
PING sub.test.local (172.17.0.14) 56(84) bytes of data.
64 bytes from 172.17.0.14 (172.17.0.14): icmp_seq=1 ttl=64 time=0.044 ms

And with 0.14.1:

$ pacman -Q nss-mdns
nss-mdns 0.14.1-1

$ avahi-resolve -n sub.test.local
sub.test.local	172.17.0.14

$ ping -c1 sub.test.local
PING jabber.subsub.local.workstation.lan (10.0.0.140) 56(84) bytes of data.
64 bytes from workstation.localdomain (10.0.0.140): icmp_seq=1 ttl=64 time=0.022 ms

avahi-resolve is working properly, ping according to nss with nss-mdns not.
The latter IP (10.0.0.140 is my host IP)

My /etc/nsswitch.conf looks like this:

hosts: files mymachines mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname

Which is working fine with the 0.10 version. I also tried to use the mdns4 module
instead of the mdns4_minimal one, without effect.

A regular avahi config for a subdomain in use looks like this (/etc/avahi/avahi-daemon.conf):

[server]
host-name=sub
domain-name=test.local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000

[wide-area]
enable-wide-area=yes

[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no

[reflector]
#enable-reflector=no
#reflect-ipv=no

[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=

cannot resolve hosts in Fedora 29

I'm running Fedora 29 and unable to resolve "*.local" hosts using nss-mdns.

Avahi seems to be working because when I run avahi-browse --all --resolve the hosts appear in the output:

action@slim ~ avahi-browse --all --resolve
...
= wlp2s0 IPv4 myantsle                                      SSH Remote Terminal  local
   hostname = [myantsle.local]
   address = [192.168.0.34]
   port = [22]
   txt = []

But when I try to ping the host by its name it's unresolvable:

 action@slim ~ ping myantsle.local
ping: myantsle.local: Name or service not known

I can ping the same host by IP without any problems:

action@slim ~ ping 192.168.0.34
PING 192.168.0.34 (192.168.0.34) 56(84) bytes of data.
64 bytes from 192.168.0.34: icmp_seq=1 ttl=64 time=2.09 ms
64 bytes from 192.168.0.34: icmp_seq=2 ttl=64 time=2.64 ms
64 bytes from 192.168.0.34: icmp_seq=3 ttl=64 time=1.87 ms
^C
--- 192.168.0.34 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 1.877/2.203/2.642/0.322 ms

I'm sure this has something to do with authselect but I don't know enough about nss, authselect, or avahi to troubleshoot this intelligently. I tried editing '/etc/nsswitch.conf' and '/etc/authselect/nsswitch.conf' directly and then restarting the avahi daemon. Both files contain the line:

hosts:      files dns mdns4_minimal [NOTFOUND=return] myhostname

I'm not sure what else to try.

IPv6 lookup adds scope ID for global scope addresses

IPv6 addresses returned always have an scope ID set, even for global scope addresses that should not have one. This is benign in some cases, but breaks mount.nfs due to the way it passes the address string to the kernel.

Memory leak in reverse lookup

It looks like there is a strdup with no free with reverse lookup names. This is an old bug, but I would guess rarely encountered since reverse lookups with nss-mdns are rare.

In order to trigger it, I had to configure an autoip interface and run avahi on it, then do a lookup on the IPv4 link local address.

_nss_mdns_gethostbyname4_r crash with glibc 2.25

nss-mdns 0.11 crashes reliably on GuixSD (GNU/Linux with glibc 2.25) when doing getaddrinfo lookups (0.10 was fine):

$ sudo ltrace ping ribbon.local
[...]
getaddrinfo("ribbon.local", nil, 0x7ffc1c86ee80, 0x7ffc1c86ee78)                                                                                              = -2
error(1, 0, 0x40c2ac, 0ping: unknown host
 <no return ...>
+++ exited (status 1) +++
$ sudo ltrace getent hosts ribbon.local
mtrace()                                                                                                                                                      = <void>
setlocale(LC_ALL, "")                                                                                                                                         = "LC_CTYPE=en_US.utf8;LC_NUMERIC=e"...
textdomain("libc")                                                                                                                                            = "libc"
argp_parse(0x605440, 3, 0x7ffdfe8f7c08, 0)                                                                                                                    = 0
strcmp("hosts", "hosts")                                                                                                                                      = 0
inet_pton(10, 0x7ffdfe8f85b3, 0x7ffdfe8f7aa0, 8)                                                                                                              = 0
inet_pton(2, 0x7ffdfe8f85b3, 0x7ffdfe8f7aa0, 0xff42000000000000)                                                                                              = 0
gethostbyname2(0x7ffdfe8f85b3, 10, 0, 66)                                                                                                                     = 0x7f8524197200
inet_ntop(10, 0x21c5088, 0x7ffdfe8f7a40, 46)                                                                                                                  = 0x7ffdfe8f7a40
printf("%-15s %s", "fe80::bcb:7426:", "ribbon.local")                                                                                                         = 37
__overflow(0x7f8524194600, 10, 0x7f8524195760, 0x7fffffdafe80::bcb:7426:7adb:6aa7 ribbon.local
)                                                                                                    = 10
+++ exited (status 0) +++

The first execution triggers an nscd crash. Backtrace:

Core was generated by `/gnu/store/3h31zsqxjjg52da5gp3qmhkh4x8klhah-glibc-2.25/sbin/nscd -f /gnu/store/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
106	../sysdeps/x86_64/strlen.S: Dosiero aŭ dosierujo ne ekzistas.
[Current thread is 1 (Thread 0x7fee65a4b700 (LWP 32659))]
(gdb) bt
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x000055a0e3263883 in addhstaiX (db=db@entry=0x55a0e3472340 <dbs+704>, 
    fd=fd@entry=13, req=req@entry=0x7fee65a4a8c0, key=key@entry=0x7fee65a4ab10, 
    uid=uid@entry=4294967295, he=he@entry=0x0, dh=0x0) at aicache.c:174
#2  0x000055a0e326432e in addhstai (db=db@entry=0x55a0e3472340 <dbs+704>, 
    fd=fd@entry=13, req=req@entry=0x7fee65a4a8c0, key=key@entry=0x7fee65a4ab10, 
    uid=uid@entry=4294967295) at aicache.c:571
#3  0x000055a0e325857a in handle_request (uid=4294967295, pid=<optimized out>, 
    key=0x7fee65a4ab10, req=0x7fee65a4a8c0, fd=13) at connections.c:1275
#4  nscd_run_worker (p=<optimized out>) at connections.c:1762
#5  0x00007fee6b66e454 in start_thread (arg=0x7fee65a4b700) at pthread_create.c:456
#6  0x00007fee6b1987cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
(gdb) bt full
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
No locals.
#1  0x000055a0e3263883 in addhstaiX (db=db@entry=0x55a0e3472340 <dbs+704>, fd=fd@entry=13, req=req@entry=0x7fee65a4a8c0, key=key@entry=0x7fee65a4ab10, uid=uid@entry=4294967295, 
    he=he@entry=0x0, dh=0x0) at aicache.c:174
        atmem = {next = 0x55a0e3472800 <readylist_lock>, name = 0x0, family = 1801920929, addr = {32750, 0, 2, 1801929696}, scopeid = 32750}
        at = 0x7fee65a4a7e0
        addrs = <optimized out>
        family = <optimized out>
        status = {-1, -1}
        naddrs = 2
        canon = 0x0
        canonlen = <optimized out>
        cp = <optimized out>
        addrslen = 0
        fct4 = <optimized out>
        dataset = 0x0
        hosts_database = 0x55a0e42025d0
        nip = 0x55a0e4202610
        no_more = 0
        rc6 = 0
        rc4 = 0
        herrno = 0
        old_res_options = 705
        tmpbuf6len = 1024
        tmpbuf6 = 0x7fee65a4a2e0 "pluto.local"
        tmpbuf4len = <optimized out>
        tmpbuf4 = <optimized out>
        ttl = 2147483647
        total = 0
        key_copy = 0x0
        alloca_used = false
        timeout = 9223372036854775807
        __PRETTY_FUNCTION__ = "addhstaiX"
#2  0x000055a0e326432e in addhstai (db=db@entry=0x55a0e3472340 <dbs+704>, fd=fd@entry=13, req=req@entry=0x7fee65a4a8c0, key=key@entry=0x7fee65a4ab10, uid=uid@entry=4294967295)
    at aicache.c:571
No locals.
#3  0x000055a0e325857a in handle_request (uid=4294967295, pid=<optimized out>, key=0x7fee65a4ab10, req=0x7fee65a4a8c0, fd=13) at connections.c:1275
        db = 0x55a0e3472340 <dbs+704>
#4  nscd_run_worker (p=<optimized out>) at connections.c:1762
        keybuf = "pluto.local", '\000' <repeats 1013 times>
        fd = 13
        pid = <optimized out>
        it = <optimized out>
        req = {version = 2, type = GETAI, key_len = 12}
        uid = 4294967295
        buf = '\000' <repeats 255 times>
#5  0x00007fee6b66e454 in start_thread (arg=0x7fee65a4b700) at pthread_create.c:456
        __res = <optimized out>
        pd = 0x7fee65a4b700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140661884237568, -461186331514265124, 140724270282382, 140724270282383, 0, 140661884237568, 451840114903196124, 
                451872565911724508}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#6  0x00007fee6b1987cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
No locals.

More details at https://bugs.gnu.org/30396 .

Add a man page please

The documentation at http://0pointer.de/lennart/projects/nss-mdns/ says that by default (without /etc/mdns.allow present) nss-mdns behaves as though this file were there with the content:

.local.
.local

However this piece of documentation is not current. The dated page above puzzled me, and I believe the lack of updated information was the issue here, even though the topic-starter eventually blamed it on his router. But the behavior described is exactly what I've been getting until I created /etc/mdns.allow with its content.

So I believe a man page is needed:

  1. Even where readme.md is present, many will habitually use "man foo".
  2. In Arch and its derivatives there are no docs apart from man pages.

It had me scratching my head a lot of time before I realized why .local names were not being resolved :)

What should "make check" do

When running make check I get the following details:

============================================================================
Testsuite summary for nss-mdns 0.15.1
============================================================================
# TOTAL: 0
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

so shouldn't it run some tests?

Add a configure option to specify the avahi-daemon socket

Right now the socket location to avahi-daemon is hard-coded in src/Makefile.am via
-DAVAHI_SOCKET=\"$(localstatedir)/run/avahi-daemon/socket\"
It would be nice to be able to specify this option during configure since the avahi-daemon socket location might as well reside under /run directly.

Update FSF address

rpmlint detects several places with the old FSF address. This should be updated everywhere.

mDNS resolution fails once then succeeds

I'm trying to troubleshoot an issue with a machine that fails to resolve mDNS domains.

avahi-resolve --name yorp.local seems to always work.
getent hosts yorp.local (yorp's the local host name) consistently fails once and then succeeds a number of times. Same behavior with ping yorp.local, first an invocation fails, subsequent invocations tend to succeed.

My hypothesis is that the first request actually goes out to the LAN and does eventually get a response but a failure is returned anyway. Then subsequent requests succeed because they hit some sort of cache. Until that cache entry is cleared.

I ran a loop to test this hypothesis.

> for i in (seq 100); printf '%d: ' "$i"; getent hosts yorp.local || printf '\n'; sleep 10; end
1: 
2: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
3: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
4: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
5: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
6: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
7: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
8: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
9: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
10: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
11: 
12: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
13: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
14: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
15: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
16: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
17: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
18: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
19: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
20: 
21: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
22: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
23: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
24: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
25: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
26: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
27: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
28: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
29: 
30: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
31: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
32: ::1             yorp.local
33: ::1             yorp.local
34: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
35: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
36: 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3 yorp.local
37: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
38: 
39: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local
40: 2a02:1810:4480:fe00:41c1:c941:e6ca:4df yorp.local

It does look like every ~9 iterations, so every minute and a half, the getent query times out. I'm not sure why the resolved address sometimes differs though. Maybe it is doing queries after all and my host sends all of those answers and sometimes they arrive in different orders? That doesn't explain the time outs though.

All three of those addresses are valid for my wired connection. ::1 is the default loopback address IIUC. I'm not entirely sure what the other two are but I think there may be two due to privacy extensions or something? The properties do differ.

    inet6 2a02:1810:4480:fe00:41c1:c941:e6ca:4df/64 scope global temporary dynamic 
    inet6 2a02:1810:4480:fe00:bb6b:d829:8b54:a7c3/64 scope global dynamic mngtmpaddr noprefixroute

Potentially relevant config files:

I've been testing things, normally I use mdns4 instead of mdns_minimal because I use subdomains.

~> cat /etc/nsswitch.conf
passwd:    files systemd
group:     files systemd
shadow:    files

hosts:     mymachines files myhostname mdns_minimal [NOTFOUND=return] dns
networks:  files

ethers:    files
services:  files
protocols: files
rpc:       files

avahi-daemon is run with the following configuration passed in using the -f flag.

~> cat /nix/store/7wn5q6dakf56lidd0vzh6hw2rw74yxrz-avahi-daemon.conf
[server]
host-name=yorp
browse-domains=
use-ipv4=yes
use-ipv6=no

domain-name=local
allow-point-to-point=no


[wide-area]
enable-wide-area=yes

[publish]
disable-publishing=no
disable-user-service-publishing=no
publish-addresses=yes
publish-hinfo=no
publish-workstation=no
publish-domain=no

[reflector]
enable-reflector=no

Remove debian directory?

Not sure if we need to keep the debian directory around anymore. I don't know the debian practice here. For Fedora, upstream doesn't keep such things.

Windows Client subdomain resolution

From a Windows client - subdomain resolution doesn't work eg :
hostname.local works
but
hostname.domain.local will not.
Any work arounds ? I have Bonjour installed on windows 10.

Transfer this repository to avahi GitHub organization

Dear nss-mdns team, @lathiat, @agoode,

Any progress for the transfer of this avahi repository (https://github.com/lathiat/avahi) and nss-mdns repository (https://github.com/lathiat/nss-mdns) to avahi-project GitHub organization that I have created to have a best future, a best development, new releases?
Note: I have not rights now.

I think that @agoode must to be in the avahi-project GitHub organization (if it is not yet).

Badly, at this time, a lot of people think that it is a dead project like Avahi and maybe unsecure like Avahi.

Some projects have been blocked at an old place because the "original" repository can not be transfered because a death, away dev, ...

For example:

Thanks in advance.

Add check for fully qualified IPv4 and IPv6 Domains

Add a check for *.local AND valid ipv6 address ANDOR ping a valid ipv6 address (either ipv6.arpa. or a user-selectable one).

Hopefully that will resolve some incompatability with ARM-powered devices since Bonjour got patched last year by Apple.

unable to resolve own hostname

I am using nss-mdns-0.14.1 and it works in general. avahi-browse --all --resolve --terminate shows results and I can also avahi-resolve-host-name the results.

The only thing that does not work is querying my own local hostname.

My config looks like this:

[server]
#host-name=foo
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000

[wide-area]
enable-wide-area=yes

[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no

[reflector]
#enable-reflector=no
#reflect-ipv=no
#reflect-filters=_airplay._tcp.local,_raop._tcp.local

[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=3

Please update copyright notices

While updating Debian's nss-mdns package I noticed that the most recent copyright notices in this project say it is © 2004-2007 Lennart Poettering. Presumably the new maintainers have written something copyrightable since then?

(I can guess at authors from the git history, but I can't know who holds the copyright: for example @agoode's contributions might be © Adam Goode, © Google Inc., or a mixture of the two.)

no response from avahi-daemon

hello, i'm running arch linux with the bellow versions,

extra/avahi 0.8+20+gd1e71b3-1 (437.0 KiB 1.8 MiB) (Installed)
    Service Discovery for Linux using mDNS/DNS-SD -- compatible with Bonjour
extra/nss-mdns 0.14.1-3 (11.5 KiB 106.1 KiB) (Installed)
    glibc plugin providing host name resolution via mDNS

i tried the newer version of the nss-mdns 0.15.x installed via pacman but neither seem to work, so rolled back to the prior version.

for debugging the avahi service on this arch linux box i'm using ping and starting the avahi-daemon in a foreground process.

sudo -E /usr/sbin/avahi-daemon --debug

yields

Process 802957 died: No such process; trying to remove PID file. (/run/avahi-daemon//pid)
Found user 'avahi' (UID 975) and group 'avahi' (GID 975).
Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
chroot.c: chroot() helper started
Successfully called chroot().
Successfully dropped remaining capabilities.
chroot.c: chroot() helper got command 02
Loading service file /services/ssh.service.
Loading new static hostname tc.local.
Network interface enumeration completed.
Server startup complete. Host name is archmbp.local. Local service cookie is 3260164840.
Service "archmbp" (/services/ssh.service) successfully established.
Static host name "tc.local" successfully established.

i then try to ping archmbp.local using the below command,

ping archmbp.local

in the foreground of the avahi daemon process the below is printed to STDOUT

simple-protocol.c: Got RESOLVE-HOSTNAME-IPV4 request for 'archmbp.local'.

and in the separate terminal process with the ping cmd it eventually times out i believe, and returns,

ping: archmbp.local: Name or service not known

running, strace ping archmbp.local

execve("/usr/sbin/ping", ["ping", "archmbp.local"], 0x7ffc6dbf2a58 /* 93 vars */) = 0
brk(NULL)                               = 0x556e8587a000
arch_prctl(0x3001 /* ARCH_??? */, 0x7fff5f0db190) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=93920, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 93920, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8133e6b000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=38704, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8133e69000
mmap(NULL, 41016, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8133e5e000
mmap(0x7f8133e61000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f8133e61000
mmap(0x7f8133e65000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f8133e65000
mmap(0x7f8133e67000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7f8133e67000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libidn2.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0  \0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=132872, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 135200, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8133e3c000
mmap(0x7f8133e3e000, 20480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f8133e3e000
mmap(0x7f8133e43000, 102400, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f8133e43000
mmap(0x7f8133e5c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f000) = 0x7f8133e5c000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20G\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=92496, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 104608, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8133e22000
mprotect(0x7f8133e26000, 73728, PROT_NONE) = 0
mmap(0x7f8133e26000, 57344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7f8133e26000
mmap(0x7f8133e34000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x7f8133e34000
mmap(0x7f8133e38000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f8133e38000
mmap(0x7f8133e3a000, 6304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f8133e3a000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`|\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0@\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 80, 848) = 80
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0K@g7\5w\10\300\344\306B4Zp<G"..., 68, 928) = 68
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2150424, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 1880536, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8133c56000
mmap(0x7f8133c7c000, 1355776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f8133c7c000
mmap(0x7f8133dc7000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x171000) = 0x7f8133dc7000
mmap(0x7f8133e13000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bc000) = 0x7f8133e13000
mmap(0x7f8133e19000, 33240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f8133e19000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libunistring.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \20\1\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1574712, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 1579272, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8133ad4000
mmap(0x7f8133ae5000, 217088, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11000) = 0x7f8133ae5000
mmap(0x7f8133b1a000, 1273856, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x46000) = 0x7f8133b1a000
mmap(0x7f8133c51000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17c000) = 0x7f8133c51000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8133ad2000
arch_prctl(ARCH_SET_FS, 0x7f8133ad3040) = 0
mprotect(0x7f8133e13000, 12288, PROT_READ) = 0
mprotect(0x7f8133c51000, 16384, PROT_READ) = 0
mprotect(0x7f8133e38000, 4096, PROT_READ) = 0
mprotect(0x7f8133e5c000, 4096, PROT_READ) = 0
mprotect(0x7f8133e67000, 4096, PROT_READ) = 0
mprotect(0x556e8483d000, 4096, PROT_READ) = 0
mprotect(0x7f8133eb0000, 8192, PROT_READ) = 0
munmap(0x7f8133e6b000, 93920)           = 0
prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1
prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1
prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
brk(NULL)                               = 0x556e8587a000
brk(0x556e8589b000)                     = 0x556e8589b000
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=0, inheritable=0}) = 0
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0
capset({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=0, inheritable=0}) = 0
prctl(PR_SET_KEEPCAPS, 1)               = 0
getuid()                                = 1000
setuid(1000)                            = 0
prctl(PR_SET_KEEPCAPS, 0)               = 0
getuid()                                = 1000
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=3041456, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 3041456, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f81337eb000
close(3)                                = 0
getrandom("\x4c\xeb\x38\x88", 4, GRND_NONBLOCK) = 4
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=0, inheritable=0}) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP) = 3
socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6) = 4
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=0, inheritable=0}) = 0
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=56353, ...}, AT_EMPTY_PATH) = 0
read(5, "# GNU libc iconv configuration.\n"..., 4096) = 4096
read(5, "B1002//\tJUS_I.B1.002//\nmodule\tJU"..., 4096) = 4096
read(5, "\tISO-IR-110//\t\tISO-8859-4//\nalia"..., 4096) = 4096
read(5, "\t\t\tISO-8859-14//\nalias\tISO_8859-"..., 4096) = 4096
read(5, "DIC-ES//\nalias\tEBCDICES//\t\tEBCDI"..., 4096) = 4096
read(5, "CDIC-CP-ES//\t\tIBM284//\nalias\tCSI"..., 4096) = 4096
read(5, "\t\tIBM863//\nalias\tOSF1002035F//\t\t"..., 4096) = 4096
read(5, "937//\t\tIBM937//\nmodule\tIBM937//\t"..., 4096) = 4096
read(5, "UJIS//\t\t\tEUC-JP//\nmodule\tEUC-JP/"..., 4096) = 4096
read(5, "lias\tISO2022CN//\t\tISO-2022-CN//\n"..., 4096) = 4096
read(5, "O_5427-EXT//\nalias\tISO_5427EXT//"..., 4096) = 4096
read(5, "ost\nmodule\tMAC-SAMI//\t\tINTERNAL\t"..., 4096) = 4096
read(5, "112//\t\tINTERNAL\t\tIBM1112\t\t1\nmodu"..., 4096) = 4096
brk(0x556e858bc000)                     = 0x556e858bc000
read(5, "s\tCP9448//\t\tIBM9448//\nalias\tCSIB"..., 4096) = 3105
read(5, "", 4096)                       = 0
close(5)                                = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5
connect(5, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(5)                                = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5
connect(5, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(5)                                = 0
newfstatat(AT_FDCWD, "/etc/nsswitch.conf", {st_mode=S_IFREG|0644, st_size=318, ...}, 0) = 0
newfstatat(AT_FDCWD, "/", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=318, ...}, AT_EMPTY_PATH) = 0
read(5, "# Name Service Switch configurat"..., 4096) = 318
read(5, "", 4096)                       = 0
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=318, ...}, AT_EMPTY_PATH) = 0
close(5)                                = 0
newfstatat(AT_FDCWD, "/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=50, ...}, 0) = 0
openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=73, ...}, AT_EMPTY_PATH) = 0
read(5, "# Resolver configuration file.\n#"..., 4096) = 73
read(5, "", 4096)                       = 0
close(5)                                = 0
openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=50, ...}, AT_EMPTY_PATH) = 0
read(5, "# Generated by NetworkManager\nna"..., 4096) = 50
read(5, "", 4096)                       = 0
uname({sysname="Linux", nodename="archmbp", ...}) = 0
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=50, ...}, AT_EMPTY_PATH) = 0
close(5)                                = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=93920, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 93920, PROT_READ, MAP_PRIVATE, 5, 0) = 0x7f8133e6b000
close(5)                                = 0
openat(AT_FDCWD, "/usr/lib/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P5\0\0\0\0\0\0"..., 832) = 832
newfstatat(5, "", {st_mode=S_IFREG|0755, st_size=51376, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 79320, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f81337d7000
mmap(0x7f81337da000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x7f81337da000
mmap(0x7f81337e1000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0xa000) = 0x7f81337e1000
mmap(0x7f81337e3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0xb000) = 0x7f81337e3000
mmap(0x7f81337e5000, 21976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f81337e5000
close(5)                                = 0
mprotect(0x7f81337e3000, 4096, PROT_READ) = 0
munmap(0x7f8133e6b000, 93920)           = 0
openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=140, ...}, AT_EMPTY_PATH) = 0
lseek(5, 0, SEEK_SET)                   = 0
read(5, "# Static table lookup for hostna"..., 4096) = 140
read(5, "", 4096)                       = 0
close(5)                                = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=93920, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 93920, PROT_READ, MAP_PRIVATE, 5, 0) = 0x7f8133e6b000
close(5)                                = 0
openat(AT_FDCWD, "/usr/lib/libnss_mdns4_minimal.so.2", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \20\0\0\0\0\0\0"..., 832) = 832
newfstatat(5, "", {st_mode=S_IFREG|0755, st_size=18104, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 20496, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f81337d1000
mmap(0x7f81337d2000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x1000) = 0x7f81337d2000
mmap(0x7f81337d4000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x7f81337d4000
mmap(0x7f81337d5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x7f81337d5000
close(5)                                = 0
mprotect(0x7f81337d5000, 4096, PROT_READ) = 0
munmap(0x7f8133e6b000, 93920)           = 0
newfstatat(AT_FDCWD, "/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=50, ...}, 0) = 0
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 5
setsockopt(5, SOL_IP, IP_RECVERR, [1], 4) = 0
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.1.1")}, 16) = 0
poll([{fd=5, events=POLLOUT}], 1, 0)    = 1 ([{fd=5, revents=POLLOUT}])
sendto(5, "\"\212\1\0\0\1\0\0\0\0\0\0\5local\0\0\6\0\1", 23, MSG_NOSIGNAL, NULL, 0) = 23
poll([{fd=5, events=POLLIN}], 1, 5000)  = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
restart_syscall(<... resuming interrupted poll ...>) = 0
poll([{fd=5, events=POLLOUT}], 1, 0)    = 1 ([{fd=5, revents=POLLOUT}])
sendto(5, "\"\212\1\0\0\1\0\0\0\0\0\0\5local\0\0\6\0\1", 23, MSG_NOSIGNAL, NULL, 0) = 23
poll([{fd=5, events=POLLIN}], 1, 5000)  = 0 (Timeout)
close(5)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 5
fcntl(5, F_GETFD)                       = 0
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
connect(5, {sa_family=AF_UNIX, sun_path="/var/run/avahi-daemon/socket"}, 110) = 0
fcntl(5, F_GETFL)                       = 0x2 (flags O_RDWR)
newfstatat(5, "", {st_mode=S_IFSOCK|0777, st_size=0, ...}, AT_EMPTY_PATH) = 0
write(5, "RESOLVE-HOSTNAME-IPV4 archmbp.lo"..., 36) = 36
read(5, "-15 Timeout reached\n", 4096)  = 20
close(5)                                = 0
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 5
newfstatat(5, "", {st_mode=S_IFREG|0644, st_size=2998, ...}, AT_EMPTY_PATH) = 0
read(5, "# Locale name alias data base.\n#"..., 4096) = 2998
read(5, "", 4096)                       = 0
close(5)                                = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "ping: ", 6ping: )                   = 6
write(2, "archmbp.local: Name or service n"..., 40archmbp.local: Name or service not known) = 40
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(2)                           = ?
+++ exited with 2 +++

i'm obviously doing something wrong here, just not sure what it is.

i do have bridge networking setup on this box, which probably makes a difference.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether XXXXXXXX brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether XXXXXXXX brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
8: br10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether XXXXXXXX brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.24/24 brd 10.0.1.255 scope global dynamic noprefixroute br10
       valid_lft 80647sec preferred_lft 80647sec
    inet6 fe80::5c60:902d:7a32:3c25/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
9: tap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master br10 state DOWN group default qlen 1000
    link/ether XXXXXXX brd ff:ff:ff:ff:ff:ff
10: ens9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br10 state UP group default qlen 1000
    link/ether XXXXXXXX brd ff:ff:ff:ff:ff:ff
    altname enp59s0

Why does nss-mdns query the default DNS before avahi?

Trying to solve my local network's server name can take up to 14 seconds on all my local devices.
The avahi daemon cache is enabled on my Arch, Manjaro and Linux Mint clients, as well as in my Void-Linux musl server.

[mek101@arch-aspire ~]$ time getent hosts home-server.local
fe80::be5f:f4ff:fef8:2c96 home-server.local

real	0m14,026s
user	0m0,005s
sys	0m0,007s
[mek101@arch-aspire ~]$ time getent hosts home-server.local -s mdns
fe80::be5f:f4ff:fef8:2c96 home-server.local

real	0m8,323s
user	0m0,001s
sys	0m0,012s
[mek101@arch-aspire ~]$ time getent hosts home-server.local -s mdns_minimal
fe80::be5f:f4ff:fef8:2c96 home-server.local

real	0m5,087s
user	0m0,001s
sys	0m0,009s
[mek101@arch-aspire ~]$ time getent hosts home-server.local -s mdns4
192.168.0.100   home-server.local

real	0m14,045s
user	0m0,002s
sys	0m0,007s
[mek101@arch-aspire ~]$ time getent hosts home-server.local -s mdns4_minimal
192.168.0.100   home-server.local

real	0m5,279s
user	0m0,000s
sys	0m0,010s

Want code?

Hi I think I've been sent to this project as proposed new upstream for libnss-mdns and would like to know whether you are planning to assume that role?

If so, please review my issue in the systemd bug tracker. It includes patches for at least issue #5 (both Avahi and legacy mode):

  • Full support for AF_UNSPEC (previous versions just treated AF_UNSPEC as if it was AF_INET) by retrieving, and returning, both IPv4 and IPv6 results in this case.
  • Obtaining/guessing IPv6 scope IDs from avahi or mdns/legacy
  • Support for the _nss_mdns_gethostbyname4_r interface: This interface probably just wasn't around in 2007, but without it, neither AF_UNSPEC addresses nor IPv6 scope IDs can actually be passed to applications.

If there is interest I can convert this to a GitHub Pull Request.
Let me know what you thing.

Is 'unicast SOA heuristic' a problem for end users?

Take new linux desktop with nss-mdns 0.14 (Ubuntu 20.04, Ubuntu 20.10...). Put this desktop PC at home or in a small office where the ISP default DNS is serving a SOA record for ".local" domain.

Printing from that box to a local network printer will be impossible for the common end user, because printername.local resolution will never work due to SOA heuristic.

This is what the DNS for an Italian ISP, called WINDTRE (formerly known as WIND), returns when requesting the SOA record for "local" zone:

user@pc:~$ dig @151.5.216.15 local SOA
[...]
;; ANSWER SECTION:
local.			30	IN	SOA	blacklistw3.zone. hostmaster.feedrpz.block.zone. 1 10800 3600 604800 86400
local.rpz.GS.local.	3600	IN	A	127.0.0.2
[...]

This, according to README.md on SOA heuristic, will prevent libnss-mdns to resolve hosts via mDNS.

And just to complete all the steps:

user@pc:~$ dig @151.5.216.15 myprintername.local A
[...]
;; ANSWER SECTION:
myprintername.local.	60	IN	A	40.68.249.35

myprintername.local will then be resolved with that ISP advertisements webserver instead of NXDOMAIN, so CUPS will try to send your prints to your ISP.

I know that

  • There is a workaround on README.md: create the appropiate /etc/mdns.allow and use mdns4 not _minimal on nsswitch.conf
  • The ISP should not do that

but a standard user will never be able to track its problem to a SOA heuristic problem, come here, understand and fix as explained on the README.md

Also please note that current MacOS does not seem to be affected by this problem. I can't see SOA queries when launching ping myprinntername.local, and the printer name is resolved locally with its private IP address.

New release?

It is possible to have a new release?

Last is:
v0.14.1 @agoode agoode released this on 18 Mar 2018

3 years soon.

Thanks in advance.

Parallel queries for IPv4 and IPv6 should be done by mdns_minimal

Just checked how long it takes to resolve nx.local, where that host does not exist on the network. I think the problem lies in do_avahi_resolve_name() function in nss.c, which converts AF_UNSPEC to sequential IPv4, then IPv6 resolution separately. I think we need a way to request both at the same time. Let avahi resolve them in parallel and return both. Because it is serializing addresses to text records, it should be handled fine even when mixed addresses in single response.

When I have mdns_minimal nss plugin used, the query time getent ahosts nx.local takes 10s on my Fedora. It takes even more on OpenSUSE for some reason. I think even 5s is too much in general, which it takes when mdns4_minimal is used.

I think Avahi should be smart enough and speed up response time in case only one of address families returns an address. The other family might not be used, but it should not wait for long time to ensure that.

Unable to resolve hosts after update

Hello everyone.

I have tried to update nss-mdns on my system (using KaOS). I have manually compiled it with this PKGBUILD by replacing the version with v0.15. After the update and a reboot, however, ping, ssh and getent hosts failed with hostname.local. Do I need to change something in the configuration of my /etc/nsswitch.conf file?

Ensure correct management of buffers

In digging through the new gethostbyname[34] code, I'm not so sure that the buffers are correctly managed in all cases. I will try to write a small buffer manager to make this easier to verify.

Implement new config file that is honored regardless of MINIMAL configuration

In issue #46 and #64, it is clear that we want to have at least these three options configurable independently in all cases:

  • Restrict to 169.254.0.0/16 for reverse lookup (currently true in MINIMAL, false otherwise)
  • Enable two-label limit heuristic (currently true in MINIMAL, false if non-MINIMAL and /etc/mdns.allow exists)
  • Enable unicast SOA heuristic (currently true in MINIMAL, false if non-MINIMAL and /etc/mdns.allow exists)

Right now, all configuration is done through /etc/nsswitch.conf and /etc/mdns.allow. If a MINIMAL variant is used, a set of hard coded settings are honored. For non-MINIMAL, a combination of different hard coded settings and configuration from /etc/mdns.allow is used.

I propose a new set of config files that can be used to specify all these parameters for any nss-mdns configuration:

  • /etc/nss-mdns.conf
  • /etc/nss-mdns_minimal.conf
  • /etc/nss-mdns4.conf
  • /etc/nss-mdns4_minimal.conf
  • /etc/nss-mdns6.conf
  • /etc/nss-mdns6_minimal.conf

We might not need all these files, in which case we'll just use /etc/nss-mdns.conf.

Cache /etc/mdns.allow information in the process

While writing a response to mdns or mdns_minimal question of Fedora devel list, I have realized nss-mdns is too naive when parsing /etc/mdns.allow configuration.

I think nss-dns plugin of glibc could be an inspiration for a well working basic caching of configuration. I think it does some smartness about /etc/resolv.conf parsing. We want to avoid unnecessary file reading on every query request, which current mdns? plugin variants does IMO. If we could cache missing file /etc/mdns.allow, we could use just single variant.

We could as well fetch list of domains to use from avahi-daemon itself and cache that. That way we could receive instructions how to handle IPv4 and IPv6 separately, which would allow to use just single mdns plugin instead of 6 separate plugins provided now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.