Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTR RR contains backslash before space charactars within mDNS messages #1607

Open
DAMEK86 opened this issue Oct 1, 2024 · 1 comment
Open

Comments

@DAMEK86
Copy link

DAMEK86 commented Oct 1, 2024

hey, first of all create lib!

while working with zeroconf, I figured out that the following Ptr field contains additional \ characters before each space character.

// PTR RR. See RFC 1035.
type PTR struct {
	Hdr RR_Header
	Ptr string `dns:"cdomain-name"` <----
}

therefore I sniffed the mDNS package with wireshark to be sure that the \ character is not sent by the sender.

as u can see in the picture there is no \ character in the payload itself.
image

however, if i printout the Answer section of the msg struct, i get the following

[_ship._tcp.local.      4500    IN      PTR     KOSTAL\ Smart\ Energy\ Meter\ G2._ship._tcp.local. KOSTAL\ Smart\ Energy\ Meter\ G2._ship._tcp.local. 4500    CLASS32769      TXT     "model=KSEM-G2" "type=hw0200" "brand=KOSTAL" "ski=0ef1d56380ef0db6464ea97ca76d1c5a4cce1b0a" "register=false" "path=/ship/" "id=KSEM-76420087" "txtvers=1" KOSTAL\ Smart\ Energy\ Meter\ G2._ship._tcp.local.        120     CLASS32769      SRV     0 0 16369 KSEM-76420087.local. KSEM-76420087.local.   120     CLASS32769      AAAA    fe80::2d0:93ff:fe5a:b6bc KSEM-76420087.local. 120     CLASS32769      A       192.168.178.78]

my question is if u see a chance to somehow disable this character adding for mDNS entries. This would would be great.
Andreas

CC @DerAndereAndi

@metalgrid
Copy link

Same issue here, with the addition of garbling special characters. Apple devices use the character in service names (e.g. Iskren’s iPhone) which gets turned into "Iskren\\226\\128\\152s\\ iPhone._rdlink._tcp.local." in RR_Header.Name where the sequence []byte{226,128,152}) is the byte representation of the character.

Given Name is a string, it makes it very hard (and messy) to parse this into the original representation.
At this point, I'm not entirely sure that's even in the specification, but Apple devices are pretty much everywhere, so it would be great if there's a way to get the underlying data for processing without breaking the spec.

metalgrid added a commit to metalgrid/drift that referenced this issue Nov 24, 2024
this is probably not compatible with some DNS RFC
- see miekg/dns#1607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants