tungd / elixir-dns

DNS library for Elixir
BSD 3-Clause "New" or "Revised" License
114 stars 37 forks source link

Crashes when there is an Authority section #54

Open bortzmeyer opened 2 years ago

bortzmeyer commented 2 years ago

If we try to encode a response which has an Authority (nslist) section, the library crashes

** (FunctionClauseError) no function clause matching in :inet_dns.encode_res_section/3
    (kernel) inet_dns.erl:275: :inet_dns.encode_res_section(<<155, 118, 133, 0, 0, 1, 0, 0, 0, 1, 0, 1, 5, 100, 114, 105, 110, 107, 4, 116, 101, 115, 116, 0, 0, 29, 0, 1>>, {2, {["drink", "test"], 12, nil, {["test"], 18, nil, nil}}}, [%DNS.Resource{bm: [], class: :in, cnt: 0, data: {'ns1.test', 'root.drink.test', 2022082613, 1800, 300, 604800, 86400}, domain: 'drink.test', func: false, tm: :undefined, ttl: 0, type: :soa}])
    (kernel) inet_dns.erl:242: :inet_dns.encode/1
    (drink) lib/drink/server.ex:315: Drink.Server.make_response/4
    (drink) lib/drink/server.ex:157: Drink.Server.serve/6

Answer or Additional section do not have the problem.