Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/dns_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use crate::log::trace;

use crate::error::{e_fmt, Error, Result};
use crate::service_info::is_unicast_link_local;

use if_addrs::Interface;

Expand Down Expand Up @@ -143,7 +144,7 @@ impl fmt::Display for ScopedIp {
match self {
ScopedIp::V4(v4) => write!(f, "{}", v4.addr),
ScopedIp::V6(v6) => {
if v6.scope_id.index != 0 {
if v6.scope_id.index != 0 && is_unicast_link_local(&v6.addr) {
#[cfg(windows)]
{
write!(f, "{}%{}", v6.addr, v6.scope_id.index)
Expand Down
2 changes: 1 addition & 1 deletion src/service_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ pub(crate) fn split_sub_domain(domain: &str) -> (&str, Option<&str>) {
/// stable on the current mdns-sd Rust version (1.71.0).
///
/// https://github.com/rust-lang/rust/blob/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/net/ip_addr.rs#L1684
fn is_unicast_link_local(addr: &Ipv6Addr) -> bool {
pub(crate) fn is_unicast_link_local(addr: &Ipv6Addr) -> bool {
(addr.segments()[0] & 0xffc0) == 0xfe80
}

Expand Down