chiark / gitweb /
WIP DNS notes
[secnet.git] / NOTES.ip-over-dns
1 The IP-over-DNS protocol is as follows:
2
3 Encoding:
4   We don't want to go outside alphanumerics and hyphens,
5   ie hostname-legal.  So we do base32 encoding:
6   8 hostname characters encoding 5 bits each, which encodes
7   5 bytes of input data.
8
9 * Packets "up":
10   - client splits packet into appropriate fragments
11   - makes A queries for
12      
13
14
15
16 We use CNAME queries.  The request/response Q and R are bit-encoded
17 into the labels of the query domain and answer section domains,
18 respectively.
19
20 The server maintains a local cache of questions we have been asked and
21 answers we gave.  Neither side ever retries packets; so any responses
22 from our server's cache are due to resolvers between the client and
23 the server.
24
25
26 Requests by client:
27
28  Create Association
29         Q       client-init-nonce
30                 4 bits          Length of client-message-nonce in bits,
31                                  0 meaning 16; default is 8
32                 remaining       Unfragmented response message data bytes
33
34         R       5 bits          Length of associd in bits
35                                  0 meaning 32; default is 8
36                 associd
37                 queue-len-info
38                 remaining=payload
39
40  Request Down
41         Q       associd
42                 client-message-nonce
43
44         R       queue-len-info
45                 remaining=payload
46
47  Submit Up
48         Q       associd
49                 client-message-nonce
50                 payload
51
52         R       queue-len-info
53                 remaining       Unfragmented response message data bytes
54
55 queue-len-info :=
56                 4 bits          Double-logarithmic server queue length
57         # ciel(log_2( Number of bytes of queued message data ))
58         #  except that if no queued message data, value is 0
59
60 payload :=
61         [ If there is actually any data to send:
62                 1 bit           Only fragment ?
63           [ If not only fragment:
64                 1 bit           Final fragment ?
65                 12 bits         Fragment offset
66             [ In packets from server:
67                 8 bits          netlink-packet-sequence-number
68                 # In payloads from client, the client-message-nonce
69                 #  is used for reassembly.
70             ]
71           ]
72                 remaining       Data Bytes
73         ]
74
75 associd :=      n bits          as specified in Create Association response
76
77 client-init-nonce :=    64 bits         Random number
78 client-message-nonce := some bits       Sequence number, starts at random value
79         # Ie if we start having more than 255 queries outstanding, we're
80         # going to start losing things.  With our default TTL of 1s and
81         # a compliant DNS server, that might limit us to 255 packets/sec.
82         # With noncompliant DNS servers it might reduce available bandwidth.