aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-12 19:03:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-12 19:03:01 +0000
commitef1b439669f7f952633eea3879defb357224eb4c (patch)
treeb8170a8246d754661934927b82cb7090c4653e0c
parente12c90217b8de612d2dfa429a71ad458b1754cf1 (diff)
downloadbusybox-w32-ef1b439669f7f952633eea3879defb357224eb4c.tar.gz
busybox-w32-ef1b439669f7f952633eea3879defb357224eb4c.tar.bz2
busybox-w32-ef1b439669f7f952633eea3879defb357224eb4c.zip
dnsd: stop using oversized buffer. trim comment.
-rw-r--r--networking/dnsd.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c
index 5dbaec1eb..56ede3fca 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -24,15 +24,10 @@
24#define DEBUG 0 24#define DEBUG 0
25 25
26enum { 26enum {
27 /* Can tweak this */ 27 /* can tweak this */
28 DEFAULT_TTL = 120, 28 DEFAULT_TTL = 120,
29 29
30/* Cannot get bigger packets than 512 per RFC1035. 30 /* cannot get bigger packets than 512 per RFC1035. */
31 * In practice this can be set considerably smaller:
32 * Length of response packet is header (12B) + 2*type(4B) + 2*class(4B) +
33 * ttl(4B) + rlen(2B) + r (MAX_NAME_LEN = 21B) +
34 * 2*querystring (2 MAX_NAME_LEN = 42B), all together 90 Bytes
35 */
36 MAX_PACK_LEN = 512, 31 MAX_PACK_LEN = 512,
37 IP_STRING_LEN = sizeof(".xxx.xxx.xxx.xxx"), 32 IP_STRING_LEN = sizeof(".xxx.xxx.xxx.xxx"),
38 MAX_NAME_LEN = IP_STRING_LEN - 1 + sizeof(".in-addr.arpa"), 33 MAX_NAME_LEN = IP_STRING_LEN - 1 + sizeof(".in-addr.arpa"),
@@ -225,9 +220,9 @@ OPCODE 0 standard query (QUERY)
225 2 server status request (STATUS) 220 2 server status request (STATUS)
226AA Authoritative Answer - this bit is valid in responses. 221AA Authoritative Answer - this bit is valid in responses.
227 Responding name server is an authority for the domain name 222 Responding name server is an authority for the domain name
228 in question section. Answer section may have multiple owner names 223 in question section. Answer section may have multiple owner names
229 because of aliases. The AA bit corresponds to the name which matches 224 because of aliases. The AA bit corresponds to the name which matches
230 the query name, or the first owner name in the answer section. 225 the query name, or the first owner name in the answer section.
231TC TrunCation - this message was truncated. 226TC TrunCation - this message was truncated.
232RD Recursion Desired - this bit may be set in a query and 227RD Recursion Desired - this bit may be set in a query and
233 is copied into the response. If RD is set, it directs 228 is copied into the response. If RD is set, it directs
@@ -240,10 +235,10 @@ RCODE Response code.
240 0 No error condition 235 0 No error condition
241 1 Format error 236 1 Format error
242 2 Server failure - server was unable to process the query 237 2 Server failure - server was unable to process the query
243 due to a problem with the name server. 238 due to a problem with the name server.
244 3 Name Error - meaningful only for responses from 239 3 Name Error - meaningful only for responses from
245 an authoritative name server. The referenced domain name 240 an authoritative name server. The referenced domain name
246 does not exist. 241 does not exist.
247 4 Not Implemented. 242 4 Not Implemented.
248 5 Refused. 243 5 Refused.
249QDCOUNT number of entries in the question section. 244QDCOUNT number of entries in the question section.
@@ -293,7 +288,7 @@ QTYPE a two octet type of the query.
293 255 a request for all records 288 255 a request for all records
294QCLASS a two octet code that specifies the class of the query. 289QCLASS a two octet code that specifies the class of the query.
295 1 the Internet 290 1 the Internet
296 (others are historic only) 291 (others are historic only)
297 255 any class 292 255 any class
298 293
2994.1.3. Resource record format 2944.1.3. Resource record format
@@ -464,9 +459,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv)
464 unsigned lsa_size; 459 unsigned lsa_size;
465 int udps, opts; 460 int udps, opts;
466 uint16_t port = 53; 461 uint16_t port = 53;
467 /* Paranoid sizing: querystring x2 + ttl + outr_rlen + answstr */ 462 uint8_t buf[MAX_PACK_LEN + 1];
468 /* I'd rather see process_packet() fixed instead... */
469 uint8_t buf[MAX_PACK_LEN * 2 + 4 + 2 + (MAX_NAME_LEN+1)];
470 463
471 opts = getopt32(argv, "vi:c:t:p:d", &listen_interface, &fileconf, &sttl, &sport); 464 opts = getopt32(argv, "vi:c:t:p:d", &listen_interface, &fileconf, &sttl, &sport);
472 //if (opts & 0x1) // -v 465 //if (opts & 0x1) // -v