Closed montehansen closed 8 years ago
Looks like a bug where you are using .name instead of .target to encode SRV records.
If I'm wrong feel free to re-open
Thank you so much for your response. It's greatly appreciated.
Where would you suspect that to originate from? The source (iOS device), the mdns-proxy, or the multicast-dns packets class?
The mdns-proxy doesn't act differently based on record type, and I fear the rsrv change I made merely masked the symptom.
Monte
rsrv.encode = function(data, buf, offset) {
buf.writeUInt16BE(data.priority || 0, offset+2)
buf.writeUInt16BE(data.weight || 0, offset+4)
buf.writeUInt16BE(data.port || 0, offset+6)
if( data.target ) // <-- added this test
name.encode(data.target, buf, offset+8)
var len = name.encode.bytes+6
buf.writeUInt16BE(len, offset)
rsrv.encode.bytes = len+2
return buf
}
// resolve the query using DNS
dns.resolve(q.name, q.type, function (err, addresses) {
if (err != null) {
// on error, don't respond but add entry to our cache
console.log("not found: ", key, err);
cache[key] = { time: time, response: null };
} else {
// respond with the first address found
var address = addresses[0];
if (typeof address === 'undefined') {
// on empty record, just add entry to our cache
console.log("empty record: ", key, err);
cache[key] = { time: time, response: null };
} else {
var response = [{ name: q.name, type: q.type, ttl: ttl, data: address }];
console.log("resolved: ", key, response);
mdns.response(response);
// add entry to our cache
cache[key] = { time: time, response: null };
}
}
});
You were right. Duh, the response didn't conform to the SRV record spec. Thanks. Been a while since I coded in the DNS world =).
I added support for SRV records to the mdns-proxy (which multicast-dns supports), but results in a crash with this error: