Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient handling of an interface that has several IPs #120

Open
mohemiv opened this issue Jan 21, 2024 · 0 comments
Open

Insufficient handling of an interface that has several IPs #120

mohemiv opened this issue Jan 21, 2024 · 0 comments

Comments

@mohemiv
Copy link

mohemiv commented Jan 21, 2024

Let's create a simple DNS server:

#!/usr/bin/env node
 
var dns = require('native-dns');
var dns_server = dns.createServer();
 
dns_server.on('request', function(request, response) {
    try {
        console.log(request.question);
 
        response.answer.push(dns.TXT({
            name: request.question[0].name,
            data: ['TXT TXT TXT'],
            ttl: 30,
        }));
 
        response.send();
    } catch (e) {}
});
 
dns_server.on('error', function(err, buff, req, res) {
    console.log(err.stack);
});
 
dns_server.serve(53);

Now the address 0.0.0.0:53 will be bound.

If 0.0.0.0 corresponds to two IP addresses, for example 10.0.0.2 and 10.0.0.3, the code wouldn't handle this situation properly. It will receive DNS queries for 10.0.0.2 and 10.0.0.3, but will not properly respond to queries for 10.0.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant