troglobit / mdnsd

Jeremie Miller's original mdnsd
BSD 3-Clause "New" or "Revised" License
55 stars 35 forks source link

name conflict detection in v0.11 is causing a loop #50

Closed thom-nic closed 1 year ago

thom-nic commented 2 years ago

Edit: updated the title and description because the real issue is not just the typo.

Typo in warning: conlicting -> conflicting https://github.com/troglobit/mdnsd/blob/60155281eda65642ab8fcecb555137645299660a/src/mdnsd.c#L65

Also, I found that mdnsd v0.11 gets into a loop where conflict detection keeps being triggered, presumably because mdnsd is responding to its own query?
Example log snippet:

eth0: conlicting name detected foobar._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar.local. for type 1, reloading config ...
eth0: conlicting name detected foobar._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-2._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-2.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-2._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-3._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-3.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-3._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-4._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-4.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-4._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-5._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-5.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-5._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-6._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-6.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-6._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-7._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-7.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-7._http._tcp.local. for type 16, reloading config ...
eth0: conlicting name detected foobar-8._http._tcp.local. for type 33, reloading config ...
eth0: conlicting name detected foobar-8.local. for type 1, reloading config ...
eth0: conlicting name detected foobar-8._http._tcp.local. for type 16, reloading config ...

In this case I was invoking the program as simply mdnsd. I noticed if I called it as mdnsd -i eth0 behavior appears to change.

I also noticed another difference between v0.10 and v0.11. The host running mdnsd has both an autoIP address and a DHCP address. output from ip a:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
    link/ether 6c:ec:eb:a8:1b:e5 brd ff:ff:ff:ff:ff:ff
    inet 169.254.17.246/16 brd 169.254.255.255 scope link eth0
       valid_lft forever preferred_lft forever
    inet 10.0.42.195/23 brd 10.0.43.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::6eec:ebff:fea8:1be5/64 scope link
       valid_lft forever preferred_lft forever

When I query using resolvectl from another host, v0.11 gives the autoIP address:

$ resolvectl query -p mdns foobar.local
foobar.local: 169.254.17.246                 -- link: eno1

-- Information acquired via protocol mDNS/IPv4 in 1.5ms.
-- Data is authenticated: no

When running v0.10 I get the DHCP address:

$ resolvectl query -p mdns foobar.local foobar.local: 10.0.42.195 -- link: eno1

-- Information acquired via protocol mDNS/IPv4 in 1.5ms. -- Data is authenticated: no

troglobit commented 1 year ago

Hi, and sorry for the extremely late reply! I changed jobs around the time of this report and it turned a lot of things upside down for me.

I cannot reproduce this with the latest master, seems to have been fixed by @fzs in 54a4575.