improve README, make it markdeep
This commit is contained in:
parent
5a28d14d82
commit
f717ea617a
@ -1,3 +1,7 @@
|
||||
<meta charset="utf-8" emacsmode="-*- markdown -*-">
|
||||
**A warm welcome to DNS**
|
||||
<link rel="stylesheet" href="https://casual-effects.com/markdeep/latest/apidoc.css?">
|
||||
|
||||
# teaching DNS
|
||||
Welcome to tdns, the teaching authoritative server, implementing all of
|
||||
basic DNS in 1000 lines of code.
|
||||
@ -32,20 +36,81 @@ Known broken:
|
||||
* Case-insensitive comparison isn't 100% correct
|
||||
* RCode after one CNAME chase
|
||||
* On output (to screen) we do not escape DNS names correctly
|
||||
* TCP/IP does not follow recommended timeouts
|
||||
|
||||
The code is not yet in a teachable state, and the layout is somewhat
|
||||
confusing: some stuff is in the wrong files.
|
||||
|
||||
# Layout
|
||||
Key to a good DNS implementation is having a faithful DNS storage model.
|
||||
Key to a good DNS implementation is having a faithful DNS storage model,
|
||||
with the correct kind of objects in them.
|
||||
|
||||
Over the decades, many many nameservers have started out with an incorrect
|
||||
storage model, leading to pain later on with empty non-terminals, setting
|
||||
the 'AA' bit on glue (or not) and eventually DNSSEC ordering problems.
|
||||
storage model, leading to pain later on with empty non-terminals, case
|
||||
sensitivity, setting the 'AA' bit on glue (or not) and eventually DNSSEC
|
||||
ordering problems.
|
||||
|
||||
When storing DNS as a tree, as described in RFC 1034, a lot of things go
|
||||
right "automatically".
|
||||
right "automatically". When DNS Names are a fundamental type composed out
|
||||
of DNS Labels with the correct case-insensitive equivalence and identity
|
||||
rules, lots of problems can never happen.
|
||||
|
||||
The core or `tdns` therefore is the tree of nodes as intended in 1034. This
|
||||
The core or `tdns` therefore is the tree of nodes as intended in 1034,
|
||||
containing DNS native objects like DNS Labels and DNS Names.
|
||||
|
||||
## The DNS Tree
|
||||
The DNS Tree is of fundamental importance, and is used a number of times
|
||||
within `tdns`.
|
||||
|
||||
When storing data for the org zone, it may look like this:
|
||||
|
||||
*************************************************************************************************
|
||||
* *
|
||||
* .---. *
|
||||
* 1 +---------+ . +--------+ *
|
||||
* / '-+-' \ *
|
||||
* / | \ *
|
||||
* .-+-. .-+-. .-+-. *
|
||||
* 2 + ietf+ | ietg+ | ... + *
|
||||
* '-+-' '-+-' '---' *
|
||||
* / \ | *
|
||||
* / \ | *
|
||||
* .--+. +---. .-+-. *
|
||||
* 3 + ord | | fra + | ... + *
|
||||
* '-+-' '-+-' '---' *
|
||||
* | | *
|
||||
* .-+-. .-+-. *
|
||||
* 4 + ns1 | | ns2 + *
|
||||
* '-+-' '---' *
|
||||
* *
|
||||
*************************************************************************************************
|
||||
|
||||
This three has a depth of four. The top node has an empty name, and is
|
||||
relative to the name of the zone, in this case `org`.
|
||||
|
||||
On layer 4, we find the names `ns1.ord.ietf.org` and `ns2.fra.ietf.org`. Key
|
||||
to looking up anything in DNS is to follow the tree downwards and to observe
|
||||
what nodes are passed.
|
||||
|
||||
For example, a lookup for `www.ietf.org` starts as a lookup for `www.ietf`
|
||||
in the `org` zone (if loaded, of course). Layer 1 is where we start, and we
|
||||
look if there is a child node called `ietf`. And there is.
|
||||
|
||||
As we look at that node, we could see NS records attached to it (`ietf.org NS
|
||||
ns1.ord.ietf.org`) for example. This means our lookup is done: we've found
|
||||
a zonecut. The authoritative server should now respond with a delegation by
|
||||
returning those NS records in the Nameserver section.
|
||||
|
||||
To complete the packet, we need to look up the IPv4 and IPv6 addresses of
|
||||
`ns1.ord.ietf.org` and `ns2.fra.ietf.org`. To do this, we traverse the tree
|
||||
downward again, starting at the apex with `ns1.ord.ietf` and going to the
|
||||
`ietf`, `ord` and finally `ns1` labels. There we find attached the IP(v6)
|
||||
addresses.
|
||||
|
||||
<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="ext/markdeep.min.js"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>
|
||||
|
||||
|
||||
This
|
||||
is implemented in `dns-storage.cc` and `dns-storage.hh`.
|
||||
|
||||
This lookup mechanism will tell you if a name is fully present in a zone, or
|
||||
|
1
tdns/README.md.html
Symbolic link
1
tdns/README.md.html
Symbolic link
@ -0,0 +1 @@
|
||||
README.md
|
Loading…
Reference in New Issue
Block a user