chiark / gitweb /
d6aefbc74e8c2b4e5bd923a8d96fae1cdd7641f1
[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 So requests by the client are
21     QCLASS=IN QTYPE=CNAME !RD QNAME=<query-bit-pattern>.<my-domain>
22 and responses are
23     !RD !RA AA
24     <qname> 1 IN CNAME <response-bit-pattern>
25
26 The server maintains a local cache of questions we have been asked and
27 answers we gave.  Neither side ever retries packets; so any responses
28 from our server's cache are due to resolvers between the client and
29 the server.
30
31
32 Requests by client:
33
34  Create Association
35         Q       client-init-nonce
36                 remaining       Unfragmented response message data nybbles
37
38         R       associd
39                 queue-len-info
40                 remaining=payload
41
42  Request Down
43         Q       associd
44                 client-message-nonce
45
46         R       queue-len-info
47                 remaining=payload
48
49  Submit Up
50         Q       associd
51                 client-message-nonce
52                 payload
53
54         R       queue-len-info
55                 remaining       Unfragmented response message data bytes
56
57 queue-len-info :=
58                 4* bits         Logarithmic server queue length
59         # ciel(log_2( Number of bytes of queued message data + 1 ))
60         #  clamped to maximum value
61
62 payload :=
63         [ If there is actually any data to send:
64                 1 bit           Only fragment ?
65           [ If not only fragment:
66                 1 bit           Final fragment ?
67                 12 bits         Fragment offset
68             [ In packets from server:
69                 8* bits         netlink-packet-sequence-number
70                 # In payloads from client, the client-message-nonce
71                 #  is used for reassembly.
72             ]
73           ]
74                 remaining       Data Bytes
75         ]
76
77 associd :=              32* bits        Assigned by server
78
79 client-init-nonce :=    64 bits         Random number
80
81 client-message-nonce := 8* bits         Sequence number, starts at random value
82         # Ie if we start having more than 255 queries outstanding, we're
83         # going to start losing things.  With our default TTL of 1s and
84         # a compliant DNS server, that might limit us to 255 packets/sec.
85         # With noncompliant DNS servers it might reduce available bandwidth.
86
87 Lengths marked with * are configurable.
88
89
90
91 Need to test transparency of:
92   A -> CNAME
93   CNAME
94   PTR
95   TXT
96   TXT with binary data