Giter Club home page Giter Club logo

Comments (6)

andris9 avatar andris9 commented on July 16, 2024 1

This happens when dns2 tries to answer to a request it did not understand (mostly OPT RR). The solution in my case was to filter out unsupported types from prepared responses.

// create a filter of supported data types
const SUPPORTED_TYPES = new Set(
  Object.keys(dns.Packet.TYPE)
    .map((key) => dns.Packet.TYPE[key])
    .filter((val) => typeof val === "number")
);

const server = dns.createServer(function (request, send) {
	// filter out unsupported requests (eg. EDNS)
	if (request.additionals && request.additionals.length) {
	  request.additionals = request.additionals.filter((additional) =>
	    SUPPORTED_TYPES.has(additional.type)
	  );
	}
	....

from node-dns.

andsens avatar andsens commented on July 16, 2024 1

but the "unknown parser type: undefined(41) is still there.

That's because the encoder for that packet type doesn't exist in dns2.
Check my PR on gitlab for a more in-depth explanation.
TL;DR: This mostly (exclusively?) happens when the DNS client sends edns queries (DNS with some crypto auth request attached).

from node-dns.

andsens avatar andsens commented on July 16, 2024

I'm seeing the exact same issue. I'm a bit down the rabbit hole from minikube ingress-dns to cryptexlabs/minikube-ingress-dns:0.2.1, to the sourcecode, to this package.

My issue arises when the systemd-resolverd stub-resolver performs a query. Using dig to query the server directly is no problem. Here's the wireshark disector output:
Screenshot from 2020-03-16 12-48-57

from node-dns.

song940 avatar song940 commented on July 16, 2024

Simply clears out the additionals field in the response:

response.additionals = [];

from node-dns.

ardarico avatar ardarico commented on July 16, 2024

Thank you.

response.additionals = []; removed the error message about unknown encoder, but the "unknown parser type: undefined(41) is still there.

from node-dns.

bambusoft avatar bambusoft commented on July 16, 2024

Hi:
Running the example server for IPv6 I recieve => Warning: Message parser reports malformed message packet.

dwuser@darwin:~$ dig @localhost -p 5333 google.com aaaa
;; Warning: Message parser reports malformed message packet.

; <<>> DiG 9.16.1-Ubuntu <<>> @localhost -p 5333 google.com aaaa
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1036
;; flags: qr rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; WARNING: Message has 10 extra bytes at end

;; QUESTION SECTION:
;google.com. IN AAAA

;; Query time: 8 msec
;; SERVER: 127.0.0.1#5333(127.0.0.1)
;; WHEN: Sun Mar 21 14:01:50 CST 2021
;; MSG SIZE rcvd: 60

This is the code I m using:

const dns2 = require('dns2');
const { Packet } = dns2;
const server = dns2.createUDPServer((request, send, rinfo) => {
const response = Packet.createResponseFromRequest(request);
const [ question ] = request.questions;
const { name } = question;
response.additionals = [];
response.answers.push({
name,
type: Packet.TYPE.AAAA,
class: Packet.CLASS.IN,
ttl: 300,
address: '2001:4860:4860::8888'
});
send(response);
});

server.on('request', (request, response, rinfo) => {
console.log(request.header.id, request.questions[0]);
});
server.listen(5333);

Thank you

from node-dns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.