dnsd: stop using oversized buffer. trim comment.

This commit is contained in:
Denis Vlasenko 2009-04-12 19:03:01 +00:00
parent e12c90217b
commit ef1b439669

View File

@ -24,15 +24,10 @@
#define DEBUG 0
enum {
/* Can tweak this */
/* can tweak this */
DEFAULT_TTL = 120,
/* Cannot get bigger packets than 512 per RFC1035.
* In practice this can be set considerably smaller:
* Length of response packet is header (12B) + 2*type(4B) + 2*class(4B) +
* ttl(4B) + rlen(2B) + r (MAX_NAME_LEN = 21B) +
* 2*querystring (2 MAX_NAME_LEN = 42B), all together 90 Bytes
*/
/* cannot get bigger packets than 512 per RFC1035. */
MAX_PACK_LEN = 512,
IP_STRING_LEN = sizeof(".xxx.xxx.xxx.xxx"),
MAX_NAME_LEN = IP_STRING_LEN - 1 + sizeof(".in-addr.arpa"),
@ -464,9 +459,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv)
unsigned lsa_size;
int udps, opts;
uint16_t port = 53;
/* Paranoid sizing: querystring x2 + ttl + outr_rlen + answstr */
/* I'd rather see process_packet() fixed instead... */
uint8_t buf[MAX_PACK_LEN * 2 + 4 + 2 + (MAX_NAME_LEN+1)];
uint8_t buf[MAX_PACK_LEN + 1];
opts = getopt32(argv, "vi:c:t:p:d", &listen_interface, &fileconf, &sttl, &sport);
//if (opts & 0x1) // -v