简体   繁体   中英

Storing key-value pairs in DNS request

What is the recommended place for storing key-value pairs in a DNS request?

I'm designing a system where the DNS requests traverse multiple hops. Some hops may need to append key-value pairs to the traversing DNS request.

I thought about adding a TXT record to the questions section but it looks like no data can be set on the TXT record when it is present in the questions section (I used the dnsjava library to generate the DNS request). I also thought about using an OPT record.

What is the best practice?

Thanks, Mickael

There is no recommended place to store random information in a DNS query packet. You can perhaps try to stick some in the unused parts of an OPT RR (or just add random RDATA to it) and hope that nobody on the way will drop or corrupt it, but there will be absolutely no guarantees whatsoever that it will work. Unless, of course, you control all the software involved, in which case you're free to redefine the DNS wire format as you see fit (just don't expect to interoperate with the Internet).

Also your question smells a lot like an "AB-question". What is it that you're actually trying to achieve?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM