Comments (9)
Indeed currently there is no support for publishing two TXT records, I was not aware of any service that needed that. It's possible that this became common in more recent years, I'll have to check the RFC, but this will require some modifications to the daemon as well.
from mdnsd.
I was hoping just a change to mdsctl. I've attached another example of a service requiring multiple text records, my printer.
Note that when I run mdsctl browse -r it shows only the first TXT field:
+++ Brother HL-1210W pdl-datastream tcp
Name: Brother HL-1210W
Port: 9100
Target: BRNC03896916881.local
Address: 10.1.1.207
Txt: txtvers=1
from mdnsd.
from mdnsd.
This might be my reason to get into serious C programming :)
FYI: this is what MacOS reports when browsing for the printer:
$ dns-sd -L "Brother HL-1210W" _pdl-datastream
Lookup Brother HL-1210W._pdl-datastream._tcp.local
DATE: ---Tue 14 Mar 2017---
21:25:57.843 ...STARTING...
21:25:58.040 Brother\032HL-1210W._pdl-datastream._tcp.local. can be reached at BRNC03896916881.local.:9100 (interface 4)
txtvers=1 qtotal=1 pdl= note= ty=Brother\ HL-1210W\ series product=\(Brother\ HL-1210W\ series\) adminurl=http://BRNC03896916881.local./ priority=25 usb_MFG=Brother usb_MDL=HL-1210W\ series usb_CMD=PJL,HBP Color=F Copies=T Duplex=F Fax=F Scan=F PaperCustom=T Binary=T Transparent=F TBCP=T UUID=e3248000-80ce-11db-8000-c03896916881
It breaks up each TXT with a space and escapes any spaces within a TXT.
from mdnsd.
from mdnsd.
Hi, thanks for your prompt responses.
According to:
http://www.zeroconf.org/rendezvous/txtrecords.html
Jaguar's DNSServiceDiscovery.h APIs are, like most Unix APIs, based on C strings. How then does a client encode multiple pascal strings containing name/value pairs using a single C string? The answer is that Jaguar's DNSServiceDiscovery.h APIs use ASCII 1 as the boundary marker between constituent strings within the DNS TXT record. This value can be inserted into a C string using '\001', as shown below:
DNSServiceRegistrationCreate(..., "a=1\001b=2\001c=3", ...);
So I tried:
mdnsctl publish nas-01 adisk tcp 9 sys=waMA=3c:d9:2b:04:2b:6f,adVF=0x100$'\001'dk0=adVF=0xa1,adVN=tm,adVU=12D28B6D-AFD0-1D56-7161-723FBFE36EDC
and got this from MacOS:
Lookup nas-01._adisk._tcp.local
DATE: ---Tue 14 Mar 2017---
21:44:39.420 ...STARTING...
21:44:39.421 nas-01._adisk._tcp.local. can be reached at nas-01.local.:9 (interface 4)
sys=waMA=3c:d9:2b:04:2b:6f,adVF=0x100\\x01dk0=adVF=0xa1,adVN=tm,adVU=12D28B6D-AFD0-1D56-7161-723FBFE36EDC
If I substitute $\001\
for $\101
which is the letter 'A' then I see the 'A' in the lookup. So the shell is expanding the octal correctly.
Anyway I'm not sure if this is an Apple thing or RFC.
Thanks
from mdnsd.
Ahh ok, after reading some of rfc6763 it seems I may be barking up the wrong tree. What is really needed is a single TXT record with multiple key/value pairs: As per 6.1 of the RFC:
The format of the data within a DNS TXT record is one or more
strings, packed together in memory without any intervening gaps or
padding bytes for word alignment.
The format of each constituent string within the DNS TXT record is a
single length byte, followed by 0-255 bytes of text data.
And the example:
-------------------------------------------------------
| 0x09 | key=value | 0x08 | paper=A4 | 0x07 | passreq |
-------------------------------------------------------
So the parser needs to take multiple key/value pairs and break them up using their key/value pair length as the leading byte.
I'll take a look at parser.c and see what I come up with...
from mdnsd.
Which is how wireshark decodes a multi key/value pair TXT:
from mdnsd.
from mdnsd.
Related Issues (20)
- Supporting T_OPT (extended DNS) HOT 3
- Update README, I mean, really. HOT 2
- Build warnings HOT 2
- log severity level too high for normal cache_process messages HOT 7
- Don't preserve case on domain names.
- OpenBSD 6.1, mdnsd not receiving multicast packets? HOT 2
- Explain `mdnsctl publish` behaviour more fully in manpage HOT 3
- Write pidfile on startup HOT 3
- Permit port 0 in a service publication HOT 1
- reflector functionality HOT 2
- OpenBSD libc integration HOT 1
- release latest code to OpenBSD package repository? HOT 2
- Starting mdnsd -d with more than 30 interfaces causes a segfault HOT 3
- mdnsd stops refreshing after a while [openbsd "tl" interface with autoconfprivacy enabled]
- "insane mtu" setting for loopback HOT 2
- feature request: advertise (proxy) jail hostnames
- mdnsd leaks memory [with patch to fix it] HOT 1
- feature request: include IP address of source of unparseable RRs in log output
- pkg-readme addition
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdnsd.