diff options
author | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 20:12:35 +0200 |
---|---|---|
committer | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 20:14:00 +0200 |
commit | b741c385597d43d38c3858c816732ddc0ad1eab1 (patch) | |
tree | f26d076c4683c6e81b6c63eb3b6d6d5eef5f53a6 | |
parent | be7456f41bce09cffcaf75487b369c4d60263af2 (diff) | |
download | tinydnssec-b741c385597d43d38c3858c816732ddc0ad1eab1.tar.gz tinydnssec-b741c385597d43d38c3858c816732ddc0ad1eab1.tar.bz2 |
Apply 0004-dnscache.c-allow-a-maximum-of-20-concurrent-outgoing.diff
SHA1 138118548db85af9ff3193fb58e923c6ca877956, contained in djbdns_1.05-8ubuntu1.diff.gz
Source was http://archive.ubuntu.com/ubuntu/pool/universe/d/djbdns/djbdns_1.05-8ubuntu1.diff.gz, SHA1 0813f9370548f8699d442207bdd36ae9ef567b15
-rw-r--r-- | dnscache.c | 15 | ||||
-rw-r--r-- | log.c | 6 |
2 files changed, 21 insertions, 0 deletions
@@ -72,11 +72,15 @@ static struct udpclient { } u[MAXUDP]; int uactive = 0; +#define MAXSOA 20 +int soaactive = 0; + void u_drop(int j) { if (!u[j].active) return; log_querydrop(&u[j].active); u[j].active = 0; --uactive; + if (byte_equal(u[j].q.type,2,DNS_T_SOA)) --soaactive; } void u_respond(int j) @@ -87,6 +91,7 @@ void u_respond(int j) socket_send6(udp53,response,response_len,u[j].ip,u[j].port,u[j].scope_id); log_querydone(&u[j].active,response_len); u[j].active = 0; --uactive; + if (byte_equal(u[j].q.type,2,DNS_T_SOA)) --soaactive; } void u_new(void) @@ -125,6 +130,16 @@ void u_new(void) x->active = ++numqueries; ++uactive; log_query(&x->active,x->ip,x->port,x->id,q,qtype); + + if (byte_equal(qtype,2,DNS_T_SOA)) { + if (soaactive >= MAXSOA) { + log_querydropmaxsoa(&x->active); + x->active = 0; --uactive; + return; + } + ++soaactive; + } + switch(query_start(&x->q,q,qtype,qclass,myipoutgoing,interface)) { case -1: u_drop(j); @@ -118,6 +118,12 @@ void log_querydrop(uint64 *qnum) line(); } +void log_querydropmaxsoa(uint64 *qnum) +{ + string("drop "); number(*qnum); space(); string("maxsoa"); + line(); +} + void log_tcpopen(const char client[16],unsigned int port) { string("tcpopen "); |