Skip to content

Duplicate resolved IPv6 addresses when using multiple network interfaces #372

Closed

Description

@hrzlgnm

Having 2 Network interfaces connected to 2 different networks which are not interconnected in any way. I can observe duplication of IPv6 addresses with the scope_id of the other network where the addresses cannot actually be reached.

Query example for _http._tcp

At 348.62µs: SearchStarted("_http._tcp.local. on 6 interfaces [fe80::3236:543d:a120:72e5 (wlp13s0), 192.168.179.7 (wlp13s0), 192.168.178.53 (enp12s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0)]")
At 70.418189ms: ServiceFound("_http._tcp.local.", "Denon AVR-X1400H._http._tcp.local.")
At 70.433569ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
 host: Denon-AVR-X1400H.local.
 port: 80
 Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
 Address: fe80::205:cdff:fea5:86b0%2
 Address: 192.168.178.21
 Property: path=/settings/
At 70.461459ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
 host: Denon-AVR-X1400H.local.
 port: 80
 Address: fe80::205:cdff:fea5:86b0%3
 Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
 Address: fe80::205:cdff:fea5:86b0%2
 Address: 192.168.178.21
 Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%3
 Property: path=/settings/
At 332.554357ms: ServiceFound("_http._tcp.local.", "Tibber Bridge Web Server._http._tcp.local.")
At 332.567917ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
 host: Bridge20c228000.local.
 port: 80
 Address: 192.168.178.33
At 332.574957ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
 host: Bridge20c228000.local.
 port: 80
 Address: 192.168.178.33

What's also strange, if one disables WiFi one can only observe one resolve of each instance, in the example before we can could observe 2 for each:

At 280.27µs: SearchStarted("_http._tcp.local. on 3 interfaces [fe80::b7a:957b:f7e1:9b0e (enp12s0), 192.168.178.53 (enp12s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0)]")
At 44.121358ms: ServiceFound("_http._tcp.local.", "Denon AVR-X1400H._http._tcp.local.")
At 44.137018ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
 host: Denon-AVR-X1400H.local.
 port: 80
 Address: fe80::205:cdff:fea5:86b0%2
 Address: 192.168.178.21
 Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
 Property: path=/settings/
At 712.481579ms: ServiceFound("_http._tcp.local.", "Tibber Bridge Web Server._http._tcp.local.")
At 712.507919ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
 host: Bridge20c228000.local.
 port: 80
 Address: 192.168.178.33

From the output addresses i can only ping link local IPv6 addresses with the interface index 2, not 3.

Ping using index 3 (wlp13s0) which is connected to a guest WiFi:

ping fe80::205:cdff:fea5:86b0%3
PING fe80::205:cdff:fea5:86b0%3 (fe80::205:cdff:fea5:86b0%wlp13s0) 56 data bytes
From fe80::3236:543d:a120:72e5%wlp13s0 icmp_seq=1 Destination unreachable: Address unreachable
From fe80::3236:543d:a120:72e5%wlp13s0 icmp_seq=2 Destination unreachable: Address unreachable
From fe80::3236:543d:a120:72e5%wlp13s0 icmp_seq=3 Destination unreachable: Address unreachable

Ping using index 2(enp12s0):

ping fe80::205:cdff:fea5:86b0%2
PING fe80::205:cdff:fea5:86b0%2 (fe80::205:cdff:fea5:86b0%enp12s0) 56 data bytes
64 bytes from fe80::205:cdff:fea5:86b0%enp12s0: icmp_seq=1 ttl=255 time=0.864 ms
64 bytes from fe80::205:cdff:fea5:86b0%enp12s0: icmp_seq=2 ttl=255 time=0.384 ms
64 bytes from fe80::205:cdff:fea5:86b0%enp12s0: icmp_seq=3 ttl=255 time=0.390 ms

Output of ip addr show:

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 proto kernel_lo
       valid_lft forever preferred_lft forever
2: enp12s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d8:43:ae:b3:ea:97 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.53/24 brd 192.168.178.255 scope global dynamic noprefixroute enp12s0
       valid_lft 860430sec preferred_lft 860430sec
    inet6 2003:e8:bf13:1300:a491:e24f:acbf:68c3/64 scope global dynamic noprefixroute
       valid_lft 6861sec preferred_lft 1461sec
    inet6 fe80::b7a:957b:f7e1:9b0e/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: wlp13s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 58:cd:c9:86:54:1f brd ff:ff:ff:ff:ff:ff
    inet 192.168.179.7/24 brd 192.168.179.255 scope global dynamic noprefixroute wlp13s0
       valid_lft 21149sec preferred_lft 21149sec
    inet6 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831/64 scope global dynamic noprefixroute
       valid_lft 6862sec preferred_lft 1461sec
    inet6 fe80::3236:543d:a120:72e5/64 scope link noprefixroute
       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 52:54:00:cb:66:f6 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
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 6e:03:f8:11:28:dd 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

The issue was probably hidden behind the HashSet<IpAddr> previously and not noticeable, but now we use HashSet<HostIp> which exposes the issue.

Activity

  1. changed the title [-]Duplicate IPv6 addresses[/-] [+]Duplicate resolved IPv6 addresses[/+] on Jul 16, 2025
  2. changed the title [-]Duplicate resolved IPv6 addresses[/-] [+]Duplicate resolved IPv6 addresses when using multiple network interfaces[/+] on Jul 16, 2025
  3. keepsimple1 commented on Jul 17, 2025

    @keepsimple1
    Owner

    I was not able to reproduce this locally yet. I suspect that in your test, wlp13s0 interface somehow did also receive the multicast packet of the network of enp12s0. I am trying to understand that. Meantime, I opened a PR #373 with debugs for you to run with RUST_LOG=DEBUG cargo run ... for your test to verify that.

  4. hrzlgnm commented on Jul 17, 2025

    @hrzlgnm
    ContributorAuthor

    Yes it looks like those duplicates are also received via wlp13s0:

    At 422.319µs: SearchStarted("_http._tcp.local. on 6 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), 192.168.178.53 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0), fe80::3236:543d:a120:72e5 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0)]")
    At 41.388238ms: ServiceFound("_http._tcp.local.", "Denon AVR-X1400H._http._tcp.local.")
    [2025-07-17T17:14:52.588Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "Denon-AVR-X1400H.local.", ty: AAAA, class: 1, cache_flush: true }, ttl: 120, created: 1752772492588, expires: 1752772612588, refresh: 1752772588588, new_name: None }, address: fe80::205:cdff:fea5:86b0, interface_id: InterfaceId { name: "enp12s0", index: 2 } } from InterfaceId { name: "enp12s0", index: 2 }
    [2025-07-17T17:14:52.588Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "Denon-AVR-X1400H.local.", ty: AAAA, class: 1, cache_flush: true }, ttl: 120, created: 1752772492588, expires: 1752772612588, refresh: 1752772588588, new_name: None }, address: 2003:e8:bf13:1300:205:cdff:fea5:86b0, interface_id: InterfaceId { name: "enp12s0", index: 2 } } from InterfaceId { name: "enp12s0", index: 2 }
    At 41.513378ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 80
     Address: 192.168.178.21
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
     Address: fe80::205:cdff:fea5:86b0%2
     Property: path=/settings/
    [2025-07-17T17:14:52.589Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "Denon-AVR-X1400H.local.", ty: AAAA, class: 1, cache_flush: true }, ttl: 120, created: 1752772492589, expires: 1752772612589, refresh: 1752772588589, new_name: None }, address: fe80::205:cdff:fea5:86b0, interface_id: InterfaceId { name: "wlp13s0", index: 5 } } from InterfaceId { name: "wlp13s0", index: 5 }
    [2025-07-17T17:14:52.589Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "Denon-AVR-X1400H.local.", ty: AAAA, class: 1, cache_flush: true }, ttl: 120, created: 1752772492589, expires: 1752772612589, refresh: 1752772588589, new_name: None }, address: 2003:e8:bf13:1300:205:cdff:fea5:86b0, interface_id: InterfaceId { name: "wlp13s0", index: 5 } } from InterfaceId { name: "wlp13s0", index: 5 }
    At 41.632228ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 80
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%5
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
     Address: fe80::205:cdff:fea5:86b0%2
     Address: fe80::205:cdff:fea5:86b0%5
     Address: 192.168.178.21
     Property: path=/settings/
    At 222.459511ms: ServiceFound("_http._tcp.local.", "Tibber Bridge Web Server._http._tcp.local.")
    At 222.502921ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
     host: Bridge20c228000.local.
     port: 80
     Address: 192.168.178.33
    At 222.544311ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
     host: Bridge20c228000.local.
     port: 80
     Address: 192.168.178.33
    [2025-07-17T17:14:53.075Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "void.local.", ty: AAAA, class: 1, cache_flush: true }, ttl: 120, created: 1752772493075, expires: 1752772613075, refresh: 1752772589075, new_name: None }, address: 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831, interface_id: InterfaceId { name: "enp12s0", index: 2 } } from InterfaceId { name: "enp12s0", index: 2 }
    [2025-07-17T17:14:53.075Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "void.local.", ty: AAAA, class: 1, cache_flush: true }, ttl: 120, created: 1752772493075, expires: 1752772613075, refresh: 1752772589075, new_name: None }, address: 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831, interface_id: InterfaceId { name: "wlp13s0", index: 5 } } from InterfaceId { name: "wlp13s0", index: 5 }
    At 1.000991044s: SearchStarted("_http._tcp.local. on 6 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), 192.168.178.53 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0), fe80::3236:543d:a120:72e5 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0)]")
    [2025-07-17T17:14:55.305Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "192-168-178-64.fritz.repeater.", ty: AAAA, class: 1, cache_flush: false }, ttl: 120, created: 1752772495305, expires: 1752772615305, refresh: 1752772591305, new_name: None }, address: fe80::e408:55ff:fe19:f4c2, interface_id: InterfaceId { name: "enp12s0", index: 2 } } from InterfaceId { name: "enp12s0", index: 2 }
    [2025-07-17T17:14:55.305Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "192-168-178-64.fritz.repeater.", ty: AAAA, class: 1, cache_flush: false }, ttl: 120, created: 1752772495305, expires: 1752772615305, refresh: 1752772591305, new_name: None }, address: 2003:e8:bf13:1300:e408:55ff:fe19:f4c2, interface_id: InterfaceId { name: "enp12s0", index: 2 } } from InterfaceId { name: "enp12s0", index: 2 }
    [2025-07-17T17:14:55.305Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "192-168-178-64.fritz.repeater.", ty: AAAA, class: 1, cache_flush: false }, ttl: 120, created: 1752772495305, expires: 1752772615305, refresh: 1752772591305, new_name: None }, address: fe80::e408:55ff:fe19:f4c2, interface_id: InterfaceId { name: "wlp13s0", index: 5 } } from InterfaceId { name: "wlp13s0", index: 5 }
    [2025-07-17T17:14:55.305Z DEBUG mdns_sd::dns_cache] add_or_update: new AAAA record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "192-168-178-64.fritz.repeater.", ty: AAAA, class: 1, cache_flush: false }, ttl: 120, created: 1752772495305, expires: 1752772615305, refresh: 1752772591305, new_name: None }, address: 2003:e8:bf13:1300:e408:55ff:fe19:f4c2, interface_id: InterfaceId { name: "wlp13s0", index: 5 } } from InterfaceId { name: "wlp13s0", index: 5 }
    At 3.001281436s: SearchStarted("_http._tcp.local. on 6 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), 192.168.178.53 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0), fe80::3236:543d:a120:72e5 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0)]")
    

    But that's actually not possible, e.g. if I disable enp12s0, I get:

    At 341.569µs: SearchStarted("_http._tcp.local. on 3 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), fe80::3236:543d:a120:72e5 (wlp13s0)]")
    At 1.001857233s: SearchStarted("_http._tcp.local. on 3 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), fe80::3236:543d:a120:72e5 (wlp13s0)]")
    At 3.004226832s: SearchStarted("_http._tcp.local. on 3 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), fe80::3236:543d:a120:72e5 (wlp13s0)]")
    At 7.005422935s: SearchStarted("_http._tcp.local. on 3 interfaces [192.168.179.7 (wlp13s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), fe80::3236:543d:a120:72e5 (wlp13s0)]")
    
  5. hrzlgnm commented on Jul 17, 2025

    @hrzlgnm
    ContributorAuthor

    According to socket stats, we bind to any address on any interface on linux, instead of interface specific addresses:

    ss -lupen
    State  Recv-Q Send-Q                       Local Address:Port   Peer Address:Port Process
    UNCONN 0      0                                  0.0.0.0:5353        0.0.0.0:*     users:(("query",pid=5601,fd=6))   uid:1000 ino:28846 sk:1 cgroup:/2 <->
    UNCONN 0      0                                  0.0.0.0:5353        0.0.0.0:*     users:(("query",pid=5601,fd=5))   uid:1000 ino:28845 sk:2 cgroup:/2 <->
    UNCONN 0      0                                  0.0.0.0:5353        0.0.0.0:*                                       uid:23 ino:13479 sk:3 cgroup:/ <->
    UNCONN 0      0                            192.168.122.1:53          0.0.0.0:*                                       ino:9089 sk:4 cgroup:/ <->
    UNCONN 0      0                           0.0.0.0%virbr0:67          0.0.0.0:*                                       ino:9086 sk:5 cgroup:/ <->
    UNCONN 0      0                                127.0.0.1:323         0.0.0.0:*                                       ino:14627 sk:6 cgroup:/ <->
    UNCONN 0      0                                  0.0.0.0:33178       0.0.0.0:*                                       uid:23 ino:13481 sk:7 cgroup:/ <->
    UNCONN 0      0                                127.0.0.1:35578       0.0.0.0:*     users:(("query",pid=5601,fd=3))   uid:1000 ino:23863 sk:8 cgroup:/2 <->
    UNCONN 0      0                                     [::]:5353           [::]:*                                       uid:23 ino:13480 sk:9 cgroup:/ v6only:1 <->
    UNCONN 0      0                                        *:5353              *:*     users:(("query",pid=5601,fd=7))   uid:1000 ino:28847 sk:a cgroup:/2 v6only:0 <->
    UNCONN 0      0                                        *:5353              *:*     users:(("query",pid=5601,fd=8))   uid:1000 ino:28848 sk:b cgroup:/2 v6only:0 <->
    UNCONN 0      0                                        *:5353              *:*     users:(("query",pid=5601,fd=9))   uid:1000 ino:28849 sk:c cgroup:/2 v6only:0 <->
    UNCONN 0      0                                        *:5353              *:*     users:(("query",pid=5601,fd=10))  uid:1000 ino:28850 sk:d cgroup:/2 v6only:0 <->
    UNCONN 0      0                                    [::1]:323            [::]:*                                       ino:14628 sk:e cgroup:/ v6only:1 <->
    UNCONN 0      0      [fe80::3236:543d:a120:72e5]%wlp13s0:546            [::]:*                                       ino:27924 sk:f cgroup:/ v6only:1 <->
    UNCONN 0      0       [fe80::b7a:957b:f7e1:9b0e]%enp12s0:546            [::]:*                                       ino:14152 sk:10 cgroup:/ v6only:1 <->
    UNCONN 0      0                                     [::]:49992          [::]:*                                       uid:23 ino:13482 sk:11 cgroup:/ v6only:1 <->
    

    Which explains what we can observe the duplicate packets under Linux.

    I'm also able to observe duplication across multiple interfaces on another machine where for example VPN interfaces are also involved, but actually cannot do multicast.

  6. keepsimple1 commented on Jul 18, 2025

    @keepsimple1
    Owner

    According to socket stats, we bind to any address on any interface on linux, instead of interface specific addresses:

    yes, but we also specify the interface when calling join_multicast_v6. It seems that the behavior is different on macOS (where I was not able to reproduce) and Linux. Now running on Linux, I see the same issue.

    Avahi uses a single socket for each protocol but utilizes IPV6_RECVPKTINFO to also receive information interface the packet was received on:

    We have a pending issue #65 (and PR #190) which will would also help address this problem. Meanwhile, maybe we can search for some platform specific solutions.

  7. hrzlgnm commented on Jul 19, 2025

    @hrzlgnm
    ContributorAuthor

    I was also toying around quick and dirty with setsockopt SO_BINDTODEVICE, but that didn't improve the situation.

  8. hrzlgnm commented on Jul 19, 2025

    @hrzlgnm
    ContributorAuthor

    So searching for a platform specific solution with IP_PKTINFO or IP6_PKTINFO is probably the way to on Linux.

  9. keepsimple1 commented on Jul 23, 2025

    @keepsimple1
    Owner

    I have updated PR #373 with a fix for Linux (and macOS) platforms. I tested it locally and it seems to work. @hrzlgnm could you please give it a try when you have time? Thanks.

  10. hrzlgnm commented on Jul 23, 2025

    @hrzlgnm
    ContributorAuthor

    @keepsimple1 I've tested those changes and the duplicate addresses are indeed gone. But there is a catch, on a Linux system having tun interfaces due to using OpenVPN connections, those still get duplicated for the tun interface, but that's not big of a deal as I disable those interfaces in the daemon in my use case.

  11. hrzlgnm commented on Jul 23, 2025

    @hrzlgnm
    ContributorAuthor

    @keepsimple1 I've tried it out once more, and I still get duplicates it seems, don't know why I did not get any this morning:

    At 543.52µs: SearchStarted("_http._tcp.local. on 6 interfaces [2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), fe80::3236:543d:a120:72e5 (wlp13s0), 192.168.179.7 (wlp13s0), 192.168.178.53 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0)]")
    At 25.522356ms: ServiceFound("_http._tcp.local.", "Denon AVR-X1400H._http._tcp.local.")
    At 25.560236ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 80
     Address: 192.168.178.21
     Address: fe80::205:cdff:fea5:86b0%2
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
     Property: path=/settings/
    At 25.609316ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 80
     Address: fe80::205:cdff:fea5:86b0%2
     Address: 192.168.178.21
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%5
     Address: fe80::205:cdff:fea5:86b0%5
     Property: path=/settings/
    At 1.000220253s: SearchStarted("_http._tcp.local. on 6 interfaces [2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), 2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), fe80::3236:543d:a120:72e5 (wlp13s0), 192.168.179.7 (wlp13s0), 192.168.178.53 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0)]")
    
  12. keepsimple1 commented on Jul 26, 2025

    @keepsimple1
    Owner

    @hrzlgnm Thanks for testing and details! I change the approach with a big refactoring in PR #373. Now we use a common socket for all interfaces (separate for IPv4 and IPv6). This is possible because of help from socket-pktinfo crate. I tested it locally and it seems to help fixing this issue. Could you please give it a try when you have time?

  13. hrzlgnm commented on Jul 27, 2025

    @hrzlgnm
    ContributorAuthor

    @keepsimple1 I've tested the changes, the duplicate addresses are gone now.

    I found a panic, when disabling a WiFi interface while the daemon was running and resolving, could not hit it more but it should be clear why that happened, the offending line tries to set a multicast_v4 address but that probably just got removed from the network interface:

    At 302.407µs: SearchStarted("_http._tcp.local. on 4 interfaces [2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), 192.168.178.53 (enp12s0), 192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0)]")
    At 80.143141ms: ServiceFound("_http._tcp.local.", "Denon AVR-X1400H._http._tcp.local.")
    At 80.19813ms: Resolved a new service: Denon AVR-X1400H._http._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 80
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
     Address: 192.168.178.21
     Address: fe80::205:cdff:fea5:86b0%2
     Property: path=/settings/
    At 355.551353ms: ServiceFound("_http._tcp.local.", "Tibber Bridge Web Server._http._tcp.local.")
    At 355.598962ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
     host: Bridge20c228000.local.
     port: 80
     Address: 192.168.178.33
    At 1.000387634s: SearchStarted("_http._tcp.local. on 4 interfaces [2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), 192.168.178.53 (enp12s0), 192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0)]")
    At 3.001810724s: SearchStarted("_http._tcp.local. on 4 interfaces [2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), 192.168.178.53 (enp12s0), 192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0)]")
    At 7.003749624s: SearchStarted("_http._tcp.local. on 4 interfaces [2003:e8:bf13:1301:e1f1:dd6c:fb10:b831 (wlp13s0), 192.168.178.53 (enp12s0), 192.168.179.7 (wlp13s0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0)]")
    
    thread 'mDNS_daemon' panicked at src/service_daemon.rs:3705:61:
    called `Result::unwrap()` on an `Err` value: Os { code: 99, kind: AddrNotAvailable, message: "Cannot assign requested address" }
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
  14. keepsimple1 commented on Jul 27, 2025

    @keepsimple1
    Owner

    @hrzlgnm thank you for testing and found the panic! I have updated the diff to handle it gracefully and also cleaned up a bit. Please let me know if that fixes it. I will also submit a PR to socket-pktinfo crate for its patch.

  15. hrzlgnm commented on Jul 28, 2025

    @hrzlgnm
    ContributorAuthor

    @keepsimple1 Tested again, but could not reproduce the panic anymore. Code-wise it also looks good to me. I also wasn't able to trigger the respective error message that is logged now. Probably just got lucky with the timing the first time.

  16. keepsimple1 commented on Jul 29, 2025

    @keepsimple1
    Owner

    Thanks again for verifying, and your previous comments that inspired me to make the changes. Just merged the PR. If any problems, please feel free to reopen this issue or a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions