Giter Club home page Giter Club logo

evldns's People

Contributors

raybellis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evldns's Issues

Dropping / deferring requests

Ray,

I see that dropping/delaying the requests is "todo", and I needed it for one of my experiments, so I wanted to share some experience of how I did it for your info and feedback.

I was able to get it working rather nicely by adding another bit flag called "defer" to the struct evldns_server_request, and another member called "queue" which is a function pointer with the signature like that of the evldns_server_udp_write_queue, and changing the signature of *_tcp_write_queue to match (and return always 0).

Then evldns_tcp_accept_callback or evldns_udp_read_callback can set the req->queue accordingly.

Also I added an early return from server_process_packet with -1 if the req->defer is set - which avoids any writes if the callback sets it.

Thus, the deferred reply code simply needs to set the req->defer and kick off the long activity with user ptr being the struct evldns_server_request pointer.

Upon the completion of that activity, the callback prepares the wire format by
doing ldns_pkt2wire() call that is otherwise done in server_process_packet, and then call the req->queue(req).

With this, I've quite easily implemented a prototype DNS64 A-filtering proxy based on static.c example and evdns clientside async resolver: for A requests, return 0 replies, for AAAA requests, kick off an async AAAA lookup for the target to upstream, upon completion of that either return the answer or if there are no AAAA records, kick off an A lookup - which, when completes can create a synthesized AAAA reply.

Based on this experience, a couple of things that might be worth doing differently/need further work:

  1. create a couple of "wrapper queue" functions that would also prepare the on-the-wire format and put them into the req->queue rather than the existing ones

  2. there is no way to do either deferred or immediate free of the req... The deferred free can be easily done by exposing the server_request_free(), but since it can not be done from within the callback, probably having another bitflag req->drop which is processed in the respective TCP/UDP routines, might be a viable option ?

--a

sample for domain responses

What would be the best way to use evldns with dnsmasq in order to achieve following:

  • dnsmasq uses evldns as nameserver
  • if evldns can match domain with specific name it forwards A record (*.home.network -> 10.0.0.1)
  • if the name is not match, default nameserver from /etc/resolv.conf will be used

I know you could use hosts/address feature of dnsmasq, but I would like to do custom matching later, more dynamic ๐Ÿ‘

Getting the wire request for UDP queries?

Hi, Ray:

I have a use case where I'd like to be able to get at the original request sent over the wire by the client, but it looks like the .wire_request and .wire_reqlen fields in evldns_server_request are only set for TCP connections.

It looks like it would be easy to set req->wire_request = buffer; req->wire_reqlen = buflen; in evldns_udp_read_callback(). Does that sound correct?

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.