Skip to content

IPv6 link-local addresses #358

Closed
Closed

Description

@parasyte

The ServiceInfo struct returned in ServiceEvent::ServiceResolved can include link-local IPv6 addresses without any scope/zone ID information, making them useless. IPv6 requires link-local addresses, so you are pretty much guaranteed to receive these when the service browser daemon is active.

In #242, the daemon itself was fixed to allow link-local addresses to be reachable by the daemon. The problem here is that, as a client, I need the same information to be able to create a valid socket with these link-local addresses. The behavior and some background details were mentioned in this comment when IPv6 support was initially being added: #130 (comment)

My current workaround is ignoring IPv6 link-local addresses. But I would be able to use them if the interface number that the addresses were discovered on was included in the event.

Activity

  1. keepsimple1 commented on May 19, 2025

    @keepsimple1
    Owner

    A similar issue was discussed recently in #342 , and we got a basic (internal) struct committed to include the interface number, while left the full solution not decided yet.

    It seems now it's a good time to come back and work out a full solution ;-). Early one of my concerns was: only a client (i.e. querier) would use the interface number inside an address, and that would conflict with the usage of ServiceInfo on the server side. But now I think probably even the server side can benefit from specifying interface number / scope id for publishing its service on IPv6.

    And it's likely be a breaking change in API, but I think we can make it as minimum as possible.

  2. parasyte commented on May 19, 2025

    @parasyte
    Author

    Thanks! I hadn't seen #342 yet. I'm going over it, now.

    BTW, here are a few related conversations:

    I'm indifferent to any changes that might be necessary for this. I know, for instance, that the ServiceInfo is used in two places: 1. to register the service and 2. to receive service update events from the daemon. It absolutely makes sense to include the interface index in the latter. Splitting these into different structs would be acceptable to me, but I understand if others feel differently.

    Additionally, I don't know how useful it is to include the interface index in the service registration. The interface information is local to the host that is registering the service, and it cannot be used by any remote peers.

  3. keepsimple1 commented on May 20, 2025

    @keepsimple1
    Owner

    Additionally, I don't know how useful it is to include the interface index in the service registration. The interface information is local to the host that is registering the service, and it cannot be used by any remote peers.

    I imagine, if the host has two interfaces with the same link-local IPv6 address, and the user wants to publish the service only on one of the IPv6 links, then an interface index would be needed.

    Currently, such service will be published by mdns-sd on both IPv6 links as long as they have the same address. The user cannot pick only one of them.

  4. parasyte commented on May 20, 2025

    @parasyte
    Author

    That is true. The service registration should probably require a scope/zone ID for link-local IPv6 addresses to associate the interface. My comment was that the interface should not be included in any packets delivered over the network. From the other perspective, recipients should not be told which interface was used for that address. It would be irrelevant and confusing.

  5. keepsimple1 commented on Jun 9, 2025

    @keepsimple1
    Owner

    Sorry about my delay. I think I wanted to focus on the client (query) side and use the currently under-used ResolvedService to get the interface / scope id for addresses. In the long term, I hope the client side uses ResolvedService to replace ServiceInfo. Please checkout PR #362 for details, and let me know if this patch would work for you. Thanks!

    CC @hrzlgnm as issue #339 is related.

  6. hrzlgnm commented on Jun 9, 2025

    @hrzlgnm
    Contributor

    @keepsimple1 I had a look at #339. It works for me.

  7. hrzlgnm commented on Jun 9, 2025

    @hrzlgnm
    Contributor

    @keepsimple1 I've toyed around a bit more and updated the query example to use the new proposed API.
    I've noticed something weird, which may come surprising to consumers:

    When running with cargo run --example=query _mass._tcp

    At 493.979µs: SearchStarted("_mass._tcp.local. on 6 interfaces [172.17.0.1 (docker0), fe80::b7a:957b:f7e1:9b0e (enp12s0), 172.18.0.1 (br-966d8702ceaa), 192.168.122.1 (virbr0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), 192.168.178.53 (enp12s0)]")
    At 503.49506ms: ServiceFound("_mass._tcp.local.", "8da209ac7ffc4c0ba99823743ee30f28._mass._tcp.local.")
    At 503.5669ms: Resolved a new service: 8da209ac7ffc4c0ba99823743ee30f28._mass._tcp.local.
     host: mass.local.
     port: 8095
     Address: 172.30.32.1 (5: docker0)
     Property: server_id=8da209ac7ffc4c0ba99823743ee30f28
     Property: server_version=2.5.4
     Property: schema_version=26
     Property: min_supported_schema_version=24
     Property: base_url=http://172.30.32.1:8095
     Property: homeassistant_addon=True
     Property: onboard_done=True
    At 503.60877ms: Resolved a new service: 8da209ac7ffc4c0ba99823743ee30f28._mass._tcp.local.
     host: mass.local.
     port: 8095
     Address: 172.30.32.1 (5: docker0)
     Address: 172.30.32.1 (4: virbr0)
     Property: server_id=8da209ac7ffc4c0ba99823743ee30f28
     Property: server_version=2.5.4
     Property: schema_version=26
     Property: min_supported_schema_version=24
     Property: base_url=http://172.30.32.1:8095
     Property: homeassistant_addon=True
     Property: onboard_done=True
    At 503.63543ms: Resolved a new service: 8da209ac7ffc4c0ba99823743ee30f28._mass._tcp.local.
     host: mass.local.
     port: 8095
     Address: 172.30.32.1 (5: docker0)
     Address: 172.30.32.1 (4: virbr0)
     Address: 172.30.32.1 (2: enp12s0)
     Property: server_id=8da209ac7ffc4c0ba99823743ee30f28
     Property: server_version=2.5.4
     Property: schema_version=26
     Property: min_supported_schema_version=24
     Property: base_url=http://172.30.32.1:8095
     Property: homeassistant_addon=True
     Property: onboard_done=True
    At 503.6642ms: Resolved a new service: 8da209ac7ffc4c0ba99823743ee30f28._mass._tcp.local.
     host: mass.local.
     port: 8095
     Address: 172.30.32.1 (4: virbr0)
     Address: 172.30.32.1 (6: br-966d8702ceaa)
     Address: 172.30.32.1 (5: docker0)
     Address: 172.30.32.1 (2: enp12s0)
     Property: server_id=8da209ac7ffc4c0ba99823743ee30f28
     Property: server_version=2.5.4
     Property: schema_version=26
     Property: min_supported_schema_version=24
     Property: base_url=http://172.30.32.1:8095
     Property: homeassistant_addon=True
     Property: onboard_done=True
    

    We get multiple entries for the same IPv4 address but with every interface which could see it.

    Or another example with a service also having IPv6 support: cargo run --example=query _raop._tcp

    At 569.199µs: SearchStarted("_raop._tcp.local. on 6 interfaces [172.18.0.1 (br-966d8702ceaa), 192.168.122.1 (virbr0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0), fe80::b7a:957b:f7e1:9b0e (enp12s0), 192.168.178.53 (enp12s0), 172.17.0.1 (docker0)]")
    At 100.346933ms: ServiceFound("_raop._tcp.local.", "0005CDA586B2@Denon AVR-X1400H._raop._tcp.local.")
    At 100.402403ms: Resolved a new service: 0005CDA586B2@Denon AVR-X1400H._raop._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 7000
     Address: 192.168.178.21 (5: docker0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (5: docker0)
     Address: fe80::205:cdff:fea5:86b0 (5: docker0)
     Property: cn=0,1
     Property: da=true
     Property: et=0,4
     Property: ft=0x445F8A00,0x1C340
     Property: fv=p20.3.67.270
     Property: md=0,1,2
     Property: am=Denon AVR-X1400H
     Property: sf=0x4
     Property: tp=UDP
     Property: vn=65537
     Property: vs=366.0
     Property: pk=23d94723d5f4df84cfa99ae4e131ec1d6fe081864b7456de66a09ab037021af8
    At 100.462153ms: Resolved a new service: 0005CDA586B2@Denon AVR-X1400H._raop._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 7000
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (5: docker0)
     Address: fe80::205:cdff:fea5:86b0 (4: virbr0)
     Address: fe80::205:cdff:fea5:86b0 (5: docker0)
     Address: 192.168.178.21 (5: docker0)
     Address: 192.168.178.21 (4: virbr0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (4: virbr0)
     Property: cn=0,1
     Property: da=true
     Property: et=0,4
     Property: ft=0x445F8A00,0x1C340
     Property: fv=p20.3.67.270
     Property: md=0,1,2
     Property: am=Denon AVR-X1400H
     Property: sf=0x4
     Property: tp=UDP
     Property: vn=65537
     Property: vs=366.0
     Property: pk=23d94723d5f4df84cfa99ae4e131ec1d6fe081864b7456de66a09ab037021af8
    At 100.517963ms: Resolved a new service: 0005CDA586B2@Denon AVR-X1400H._raop._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 7000
     Address: fe80::205:cdff:fea5:86b0 (5: docker0)
     Address: 192.168.178.21 (2: enp12s0)
     Address: fe80::205:cdff:fea5:86b0 (4: virbr0)
     Address: fe80::205:cdff:fea5:86b0 (2: enp12s0)
     Address: 192.168.178.21 (5: docker0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (5: docker0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (4: virbr0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (2: enp12s0)
     Address: 192.168.178.21 (4: virbr0)
     Property: cn=0,1
     Property: da=true
     Property: et=0,4
     Property: ft=0x445F8A00,0x1C340
     Property: fv=p20.3.67.270
     Property: md=0,1,2
     Property: am=Denon AVR-X1400H
     Property: sf=0x4
     Property: tp=UDP
     Property: vn=65537
     Property: vs=366.0
     Property: pk=23d94723d5f4df84cfa99ae4e131ec1d6fe081864b7456de66a09ab037021af8
    At 100.616473ms: Resolved a new service: 0005CDA586B2@Denon AVR-X1400H._raop._tcp.local.
     host: Denon-AVR-X1400H.local.
     port: 7000
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (2: enp12s0)
     Address: fe80::205:cdff:fea5:86b0 (6: br-966d8702ceaa)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (6: br-966d8702ceaa)
     Address: fe80::205:cdff:fea5:86b0 (5: docker0)
     Address: 192.168.178.21 (6: br-966d8702ceaa)
     Address: 192.168.178.21 (2: enp12s0)
     Address: fe80::205:cdff:fea5:86b0 (4: virbr0)
     Address: 192.168.178.21 (4: virbr0)
     Address: fe80::205:cdff:fea5:86b0 (2: enp12s0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (5: docker0)
     Address: 192.168.178.21 (5: docker0)
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (4: virbr0)
     Property: cn=0,1
     Property: da=true
     Property: et=0,4
     Property: ft=0x445F8A00,0x1C340
     Property: fv=p20.3.67.270
     Property: md=0,1,2
     Property: am=Denon AVR-X1400H
     Property: sf=0x4
     Property: tp=UDP
     Property: vn=65537
     Property: vs=366.0
     Property: pk=23d94723d5f4df84cfa99ae4e131ec1d6fe081864b7456de66a09ab037021af8
    

    What's a bit weird from a consumers point of view, we now get IPv6 link addresses scoped to interfaces which actually don't have a link-loca IPv6 addr:

    Output of ip addr

    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 856400sec preferred_lft 856400sec
        inet6 2003:e8:bf13:1300:a491:e24f:acbf:68c3/64 scope global dynamic noprefixroute
           valid_lft 6837sec preferred_lft 1437sec
        inet6 fe80::b7a:957b:f7e1:9b0e/64 scope link noprefixroute
           valid_lft forever preferred_lft forever
    3: wlp13s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 56:e7:b9:88:9d:ad brd ff:ff:ff:ff:ff:ff permaddr 58:cd:c9:86:54:1f
    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 c2:3d:2f:ed:eb:a1 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
    6: br-966d8702ceaa: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
        link/ether ca:46:88:da:1f:8e brd ff:ff:ff:ff:ff:ff
        inet 172.18.0.1/16 brd 172.18.255.255 scope global br-966d8702ceaa
           valid_lft forever preferred_lft forever
    

    So in the example above we get the IPv6 link local scoped to

    • Address: fe80::205:cdff:fea5:86b0 (6: br-966d8702ceaa)
    • Address: fe80::205:cdff:fea5:86b0 (5: docker0)
    • Address: fe80::205:cdff:fea5:86b0 (4: virbr0)
    • Address: fe80::205:cdff:fea5:86b0 (2: enp12s0)

    But the actual only interface having a ipv6 link local address is (2: enp12s0) in this case.

    Similarly for the non link local IPv6 address, where only (2: enp12s0) can actually connect to, having an actuall IPv6 address.

    • Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (2: enp12s0)
    • Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (6: br-966d8702ceaa)
    • Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (5: docker0)
    • Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0 (4: virbr0)

    Perhaps we need to add some kind of filtering for interfaces not having ipv6 link local addresses or no ipv6 addresses at all?

  8. parasyte commented on Jun 9, 2025

    @parasyte
    Author

    I agree that the link-local addresses need to include only the interface index where it is reachable. And IPv4 and non-link-local IPv6 does not need the interface information. The addition of these creates confusion.

  9. keepsimple1 commented on Jun 10, 2025

    @keepsimple1
    Owner

    Understood that such confusion is not good. Thanks a lot for your testing @hrzlgnm! I expected such observation with localhost service loop-back seen by all interfaces, but didn't expect such for a non-localhost service. I didn't see it in a basic manual testing. Let me look into more.

  10. hrzlgnm commented on Jun 12, 2025

    @hrzlgnm
    Contributor

    What I also noticed all interfaces except enp12s0 were actually down...maybe it's a good idea to treat those as disabled?

  11. keepsimple1 commented on Jun 13, 2025

    @keepsimple1
    Owner

    I didn't see it in a basic manual testing. Let me look into more.

    @hrzlgnm I think it's because in your case, other interfaces virbr0, docker0, br-966d8702ceaa are bridges, which forwards multicast. Hence the published service address was seen by multiple interfaces.

    Perhaps we need to add some kind of filtering for interfaces not having ipv6 link local addresses or no ipv6 addresses at all?

    I agree that the link-local addresses need to include only the interface index where it is reachable. And IPv4 and non-link-local IPv6 does not need the interface information. The addition of these creates confusion.

    I've changed ResolvedService.addresses to be a HashMap<IpAddr, Vec<InterfaceId>>. i.e. for each service address, there is a list of interfaces on which the address was seen. This change is partially inspired by Apple's NWBrowser.Result.interfaces. I also updated the query example to use that.

    What do you think?

  12. hrzlgnm commented on Jun 13, 2025

    @hrzlgnm
    Contributor

    I didn't see it in a basic manual testing. Let me look into more.

    @hrzlgnm I think it's because in your case, other interfaces virbr0, docker0, br-966d8702ceaa are bridges, which forwards multicast. Hence the published service address was seen by multiple interfaces.

    Yes that's what it looks like. But those bridges are not bridged anywhere.

    brctl show
    bridge name     bridge id               STP enabled     interfaces
    br-966d8702ceaa         8000.6e177a64a807       no
    docker0         8000.aac82ee40b7c       no
    virbr0          8000.525400cb66f6       yes
    

    So maybe there is an other circumstance leading to receiving replies also on those sockets.

    Perhaps we need to add some kind of filtering for interfaces not having ipv6 link local addresses or no ipv6 addresses at all?

    I agree that the link-local addresses need to include only the interface index where it is reachable. And IPv4 and non-link-local IPv6 does not need the interface information. The addition of these creates confusion.

    I've changed ResolvedService.addresses to be a HashMap<IpAddr, Vec<InterfaceId>>. i.e. for each service address, there is a list of interfaces on which the address was seen. This change is partially inspired by Apple's NWBrowser.Result.interfaces. I also updated the query example to use that.

    What do you think?

    I've checked the changes, those would also work for me.
    To avoid having those interfaces that have their link DOWN to also show up, I'll add disabling those using ServiceDaemon::disable_interface on my side.

  13. keepsimple1 commented on Jun 13, 2025

    @keepsimple1
    Owner

    What I also noticed all interfaces except enp12s0 were actually down...maybe it's a good idea to treat those as disabled?

    I agree, however I've not found an API in ip-addrs crate to detect the operational state of these interfaces (They are configured to be UP, and are operational DOWN). Will check around.

  14. hrzlgnm commented on Jun 13, 2025

    @hrzlgnm
    Contributor
  15. keepsimple1 commented on Jun 15, 2025

    @keepsimple1
    Owner

    I'm using the crate pnet on Linux and macOS and ifconfig for windows to support that case: https://github.com/hrzlgnm/mdns-browser/blob/4d45c597a7dd65014c76e1d2dad2b5590e472f72/src-tauri/src/lib.rs#L263

    Thanks! I hope if-addrs crate can be enhanced to support checking interface UP or not. I've asked over there and also created a PR: messense/if-addrs#49 . But that's of course not in our control, so probably I will treat this as a separate issue and won't block this original issue.

  16. keepsimple1 commented on Jun 26, 2025

    @keepsimple1
    Owner

    @parasyte Just want to check, would the updated diff work for your use case? Or is it still confusing? The key change is the addresses field in ResolvedService:

        /// Addresses of the service.
        /// Each address maps to the list of interfaces on which the address is found.
        /// The interface list is particularly useful for link-local IPv6 addresses,
        /// where the same address can be found on multiple interfaces.
        pub addresses: HashMap<IpAddr, Vec<InterfaceId>>,
    

    (Btw, we will use a separate PR to filter out interfaces are "down" operationally).

  17. keepsimple1 commented on Jun 30, 2025

    @keepsimple1
    Owner

    I went through this PR again and I updated the design after more of thinking: add InterfaceId info only for IPv6 address, not for IPv4 address.

    Instead of HashMap<IpAddr, Vec<InterfaceId>>, now ResolvedService.addresses is HashSet<HostIp>. Its change is simply that the new HostIp replaces the existing IpAddr and supports scope_id for IPv6.

    Hope this make the change of ResolvedService easier to understand, and remove confusions.

  18. keepsimple1 commented on Jul 9, 2025

    @keepsimple1
    Owner

    PR merged finally ;-). Opened a new issue to track the filter for Down interfaces. If any questions, please raise them. Thanks!

  19. keepsimple1 commented on Jul 10, 2025

    @keepsimple1
    Owner

    A separate PR #369 opened to exclude the operational down interfaces. @hrzlgnm let me know if it helps in your setup.

  20. hrzlgnm commented on Jul 10, 2025

    @hrzlgnm
    Contributor

    A separate PR #369 opened to exclude the operational down interfaces. @hrzlgnm let me know if it helps in your setup.

    Thanks, tried it out and the change and indeed helps a lot in my setup and probably others, too.

    Now I have:

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

    Instead of:

    At 466.759µs: SearchStarted("_http._tcp.local. on 5 interfaces [172.17.0.1 (docker0), fe80::b7a:957b:f7e1:9b0e (enp12s0), 192.168.178.53 (enp12s0), 192.168.122.1 (virbr0), 2003:e8:bf13:1300:a491:e24f:acbf:68c3 (enp12s0)]")
    At 96.23125ms: ServiceFound("_http._tcp.local.", "Denon AVR-X1400H._http._tcp.local.")
    At 96.30142ms: 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%3
     Address: 192.168.178.21
     Property: path=/settings/
    At 96.38964ms: 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
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%3
     Address: fe80::205:cdff:fea5:86b0%3
     Property: path=/settings/
    At 96.47697ms: 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: 2003:e8:bf13:1300:205:cdff:fea5:86b0%3
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%5
     Address: 192.168.178.21
     Address: fe80::205:cdff:fea5:86b0%3
     Address: 2003:e8:bf13:1300:205:cdff:fea5:86b0%2
     Address: fe80::205:cdff:fea5:86b0%5
     Property: path=/settings/
    At 212.425841ms: ServiceFound("_http._tcp.local.", "Tibber Bridge Web Server._http._tcp.local.")
    At 212.447611ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
     host: Bridge20c228000.local.
     port: 80
     Address: 192.168.178.33
    At 212.491661ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
     host: Bridge20c228000.local.
     port: 80
     Address: 192.168.178.33
    At 212.525411ms: Resolved a new service: Tibber Bridge Web Server._http._tcp.local.
     host: Bridge20c228000.local.
     port: 80
     Address: 192.168.178.33
    
  21. hrzlgnm commented on Jul 10, 2025

    @hrzlgnm
    Contributor

    @keepsimple1 Can we have public access to the field HostIpV6::scope_id, otherwise it's not possible to use the scope_id in other means than .to_string()

  22. keepsimple1 commented on Jul 11, 2025

    @keepsimple1
    Owner

    Can we have public access to the field HostIpV6::scope_id, otherwise it's not possible to use the scope_id in other means than .to_string()

    Surely we can add that. Is it easier for you to use a method of HostIpv6 or of HostIp enum, as following?

    impl HostIpV6 {
        /// Returns the scope_id for this IPv6 address.
        pub const fn scope_id(&self) -> InterfaceId {
            self.scope_id
        }
    }

    or this:

    impl HostIp {
        /// Returns the scope_id for IPv6 addresses, or None for IPv4 addresses.
        pub const fn scope_id(&self) -> Option<InterfaceId> {
            match self {
                HostIp::V4(_) => None,
                HostIp::V6(v6) => Some(v6.scope_id),
            }
        }
    }
  23. parasyte commented on Jul 11, 2025

    @parasyte
    Author

    (Apologies for my recent silence on this. My client decided that we needed to skip local resolution and go straight for public WAN resolution in the project we are working on, so this kind of got back-burnered for me.)

    I'm going to try to find some time to give this a try.

    I can't speak for @hrzlgnm, but I would personally lean toward the method on HostIPv6, if the choice is between those two. This info only needs to be queried for IPv6 address, but only for link-local addresses. I.e., only when Ipv6Addr::is_unicast_link_local() returns true.

  24. hrzlgnm commented on Jul 11, 2025

    @hrzlgnm
    Contributor

    I'm with @parasyte here, we should go with a method of HostIpV6.

  25. keepsimple1 commented on Jul 11, 2025

    @keepsimple1
    Owner

    Thanks @parasyte @hrzlgnm I've added the access methods in PR #369 and updated test cases.

    This info only needs to be queried for IPv6 address, but only for link-local addresses. I.e., only when Ipv6Addr::is_unicast_link_local() returns true.

    Understood. Currently I'm always returning &InterfaceId for IPv6, instead of Option<&InterfaceId> as I think the ergonomic benefit overweights the "only needed for link local addrs". Besides, in mDNS cases, the relevant IPv6 addrs are always link local. (And, the client can always check is_unicast_link_local() , which is a recent stable API btw).

  26. keepsimple1 commented on Jul 13, 2025

    @keepsimple1
    Owner

    PRs merged.

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