mafintosh/multicast-dns

malformed packet

Closed this issue · 3 comments

example

this is a packet that should have 4 answers (SRV, TXT, PTR, PTR) plus some additionals (some AAAAs and some As)

it works without the additionals (maybe the AAAAs hose it?)

this is blocking switching mdns-swarm to this library :)

here's a packet that explodes if you get a chance to dig in before i do:

mdns.respond({
  "answers": [
    {
      "name": "ferdinand._simple-swarm._tcp.local",
      "type": "SRV",
      "data": {
        "target": "ferdinand.local",
        "port": 58510
      }
    },
    {
      "name": "ferdinand._simple-swarm._tcp.local",
      "type": "TXT",
      "data": "host=ci96qkft60000v5rc5h0awour"
    },
    {
      "name": "_simple-swarm._tcp.local",
      "type": "PTR",
      "data": "ferdinand._simple-swarm._tcp.local"
    },
    {
      "name": "_services._dns-sd._udp.local",
      "type": "PTR",
      "data": "_simple-swarm._tcp.local"
    }
  ],
  "additionals": [
    {
      "name": "ferdinand.local",
      "type": "AAAA",
      "data": "2604:4080:1110:8250:baf6:b1ff:fe15:4885"
    },
    {
      "name": "ferdinand.local",
      "type": "AAAA",
      "data": "2604:4080:1110:8250:18fc:7342:4ed4:24e2"
    },
    {
      "name": "ferdinand.local",
      "type": "AAAA",
      "data": "fd4c:d904:6dc2:bffd:d0a4:4cb4:f4fb:36a1"
    },
    {
      "name": "ferdinand.local",
      "type": "A",
      "data": "192.168.1.39"
    },
    {
      "name": "ferdinand.local",
      "type": "A",
      "data": "172.16.230.1"
    },
    {
      "name": "ferdinand.local",
      "type": "A",
      "data": "172.16.59.1"
    }
  ]
});

tried the above packet minus the AAAAs and it worked fine

found one issue: offset is sometimes NaN, and NaN + 1 is still NaN

yessssss found it