rrl.h File Reference

#include <isc/lang.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/types.h>

Go to the source code of this file.

Data Structures

union  dns_rrl_key
struct  dns_rrl_entry
struct  dns_rrl_hash
struct  dns_rrl_block
struct  dns_rrl_qname_buf
struct  dns_rrl_rate
struct  dns_rrl

Defines

#define DNS_RRL_H   1
#define DNS_RRL_LOG_FAIL   ISC_LOG_WARNING
#define DNS_RRL_LOG_DROP   ISC_LOG_INFO
#define DNS_RRL_LOG_DEBUG1   ISC_LOG_DEBUG(3)
#define DNS_RRL_LOG_DEBUG2   ISC_LOG_DEBUG(4)
#define DNS_RRL_LOG_DEBUG3   ISC_LOG_DEBUG(9)
#define DNS_RRL_LOG_ERR_LEN   64
#define DNS_RRL_LOG_BUF_LEN
#define DNS_RRL_MAX_PREFIX   64
#define DNS_RRL_RESPONSE_BITS   24
#define DNS_RRL_QNAMES_BITS   8
#define DNS_RRL_TS_GEN_BITS   2
#define DNS_RRL_HASH_GEN_BITS   1
#define DNS_RRL_LOG_BITS   11
#define DNS_RRL_TS_BITS   12
#define DNS_RRL_MAX_SLIP   10
#define DNS_RRL_MAX_TIME_TRAVEL   5
#define DNS_RRL_FOREVER   (1<<DNS_RRL_TS_BITS)
#define DNS_RRL_MAX_TS   (DNS_RRL_FOREVER - 1)
#define DNS_RRL_MAX_RESPONSES   ((1<<(DNS_RRL_RESPONSE_BITS-1))-1)
#define DNS_RRL_MAX_WINDOW   3600
#define DNS_RRL_MAX_RATE   1000
#define DNS_RRL_MAX_LOG_SECS   1800
#define DNS_RRL_STOP_LOG_SECS   60
#define DNS_RRL_TS_BASES   (1<<DNS_RRL_TS_GEN_BITS)
#define DNS_RRL_QNAMES   (1<<DNS_RRL_QNAMES_BITS)

Typedefs

typedef struct dns_rrl_hash dns_rrl_hash_t
typedef union dns_rrl_key dns_rrl_key_t
typedef struct dns_rrl_entry dns_rrl_entry_t
typedef struct dns_rrl_block dns_rrl_block_t
typedef struct dns_rrl_qname_buf dns_rrl_qname_buf_t
typedef struct dns_rrl_rate dns_rrl_rate_t
typedef struct dns_rrl dns_rrl_t

Enumerations

enum  dns_rrl_rtype_t {
  DNS_RRL_RTYPE_FREE = 0, DNS_RRL_RTYPE_QUERY, DNS_RRL_RTYPE_REFERRAL, DNS_RRL_RTYPE_NODATA,
  DNS_RRL_RTYPE_NXDOMAIN, DNS_RRL_RTYPE_ERROR, DNS_RRL_RTYPE_ALL, DNS_RRL_RTYPE_TCP
}
enum  dns_rrl_result_t { DNS_RRL_RESULT_OK, DNS_RRL_RESULT_DROP, DNS_RRL_RESULT_SLIP }

Functions

typedef ISC_LIST (dns_rrl_entry_t) dns_rrl_bin_t
dns_rrl_result_t dns_rrl (dns_view_t *view, const isc_sockaddr_t *client_addr, isc_boolean_t is_tcp, dns_rdataclass_t rdclass, dns_rdatatype_t qtype, dns_name_t *qname, isc_result_t resp_result, isc_stdtime_t now, isc_boolean_t wouldlog, char *log_buf, unsigned int log_buf_len)
void dns_rrl_view_destroy (dns_view_t *view)
isc_result_t dns_rrl_init (dns_rrl_t **rrlp, dns_view_t *view, int min_entries)


Define Documentation

#define DNS_RRL_H   1

Definition at line 19 of file rrl.h.

#define DNS_RRL_LOG_FAIL   ISC_LOG_WARNING

Definition at line 37 of file rrl.h.

Referenced by expand_entries(), expand_rrl_hash(), and make_log_buf().

#define DNS_RRL_LOG_DROP   ISC_LOG_INFO

Definition at line 41 of file rrl.h.

Referenced by dns_rrl(), expand_entries(), expand_rrl_hash(), log_end(), ns_client_error(), and query_find().

#define DNS_RRL_LOG_DEBUG1   ISC_LOG_DEBUG(3)

Definition at line 45 of file rrl.h.

Referenced by debit_rrl_entry(), dns_rrl(), and set_age().

#define DNS_RRL_LOG_DEBUG2   ISC_LOG_DEBUG(4)

Definition at line 49 of file rrl.h.

Referenced by dns_rrl().

#define DNS_RRL_LOG_DEBUG3   ISC_LOG_DEBUG(9)

Definition at line 53 of file rrl.h.

Referenced by debit_log(), debit_rrl_entry(), dns_rrl(), and hash_divisor().

#define DNS_RRL_LOG_ERR_LEN   64

Definition at line 56 of file rrl.h.

#define DNS_RRL_LOG_BUF_LEN

Value:

(sizeof("would continue limiting") +    \
                                 DNS_RRL_LOG_ERR_LEN +                  \
                                 sizeof(" responses to ") +             \
                                 ISC_NETADDR_FORMATSIZE +               \
                                 sizeof("/128 for IN ") +               \
                                 DNS_RDATATYPE_FORMATSIZE +             \
                                 DNS_NAME_FORMATSIZE)

Definition at line 57 of file rrl.h.

Referenced by dns_rrl_view_destroy(), ns_client_error(), and query_find().

#define DNS_RRL_MAX_PREFIX   64

Definition at line 91 of file rrl.h.

Referenced by configure_rrl(), and make_key().

#define DNS_RRL_RESPONSE_BITS   24

Definition at line 115 of file rrl.h.

#define DNS_RRL_QNAMES_BITS   8

Definition at line 117 of file rrl.h.

#define DNS_RRL_TS_GEN_BITS   2

Definition at line 120 of file rrl.h.

#define DNS_RRL_HASH_GEN_BITS   1

Definition at line 123 of file rrl.h.

#define DNS_RRL_LOG_BITS   11

Definition at line 126 of file rrl.h.

#define DNS_RRL_TS_BITS   12

Definition at line 129 of file rrl.h.

#define DNS_RRL_MAX_SLIP   10

Definition at line 132 of file rrl.h.

Referenced by configure_rrl().

#define DNS_RRL_MAX_TIME_TRAVEL   5

Definition at line 136 of file rrl.h.

Referenced by delta_rrl_time(), and set_age().

#define DNS_RRL_FOREVER   (1<<DNS_RRL_TS_BITS)

Definition at line 137 of file rrl.h.

Referenced by debit_log(), delta_rrl_time(), get_age(), and set_age().

#define DNS_RRL_MAX_TS   (DNS_RRL_FOREVER - 1)

Definition at line 138 of file rrl.h.

Referenced by set_age().

#define DNS_RRL_MAX_RESPONSES   ((1<<(DNS_RRL_RESPONSE_BITS-1))-1)

Definition at line 140 of file rrl.h.

#define DNS_RRL_MAX_WINDOW   3600

Definition at line 141 of file rrl.h.

Referenced by configure_rrl().

#define DNS_RRL_MAX_RATE   1000

Definition at line 145 of file rrl.h.

Referenced by configure_rrl().

#define DNS_RRL_MAX_LOG_SECS   1800

Definition at line 153 of file rrl.h.

Referenced by debit_rrl_entry(), and dns_rrl().

#define DNS_RRL_STOP_LOG_SECS   60

Definition at line 157 of file rrl.h.

Referenced by log_stops().

#define DNS_RRL_TS_BASES   (1<<DNS_RRL_TS_GEN_BITS)

Definition at line 240 of file rrl.h.

Referenced by set_age().

#define DNS_RRL_QNAMES   (1<<DNS_RRL_QNAMES_BITS)

Definition at line 253 of file rrl.h.

Referenced by dns_rrl_view_destroy(), and make_log_buf().


Typedef Documentation

typedef struct dns_rrl_hash dns_rrl_hash_t

Definition at line 66 of file rrl.h.

typedef union dns_rrl_key dns_rrl_key_t

Definition at line 92 of file rrl.h.

typedef struct dns_rrl_entry dns_rrl_entry_t

Definition at line 109 of file rrl.h.

typedef struct dns_rrl_block dns_rrl_block_t

Definition at line 176 of file rrl.h.

typedef struct dns_rrl_qname_buf dns_rrl_qname_buf_t

Definition at line 186 of file rrl.h.

typedef struct dns_rrl_rate dns_rrl_rate_t

Definition at line 194 of file rrl.h.

typedef struct dns_rrl dns_rrl_t

Definition at line 204 of file rrl.h.


Enumeration Type Documentation

enum dns_rrl_rtype_t

Enumerator:
DNS_RRL_RTYPE_FREE 
DNS_RRL_RTYPE_QUERY 
DNS_RRL_RTYPE_REFERRAL 
DNS_RRL_RTYPE_NODATA 
DNS_RRL_RTYPE_NXDOMAIN 
DNS_RRL_RTYPE_ERROR 
DNS_RRL_RTYPE_ALL 
DNS_RRL_RTYPE_TCP 

Definition at line 71 of file rrl.h.

enum dns_rrl_result_t

Enumerator:
DNS_RRL_RESULT_OK 
DNS_RRL_RESULT_DROP 
DNS_RRL_RESULT_SLIP 

Definition at line 257 of file rrl.h.


Function Documentation

typedef ISC_LIST ( dns_rrl_entry_t   ) 

dns_rrl_result_t dns_rrl ( dns_view_t view,
const isc_sockaddr_t client_addr,
isc_boolean_t  is_tcp,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  qtype,
dns_name_t qname,
isc_result_t  resp_result,
isc_stdtime_t  now,
isc_boolean_t  wouldlog,
char *  log_buf,
unsigned int  log_buf_len 
)

Definition at line 1008 of file rrl.c.

References dns_view::aclenv, dns_rrl::all_per_second, debit_rrl_entry(), delta_rrl_time(), dns_acl_match(), dns_lctx, DNS_LOGCATEGORY_RRL, DNS_LOGMODULE_REQUEST, DNS_R_DELEGATION, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_RRL_LOG_DEBUG1, DNS_RRL_LOG_DEBUG2, DNS_RRL_LOG_DEBUG3, DNS_RRL_LOG_DROP, DNS_RRL_MAX_LOG_SECS, DNS_RRL_RESULT_OK, DNS_RRL_RTYPE_ALL, DNS_RRL_RTYPE_ERROR, DNS_RRL_RTYPE_NODATA, DNS_RRL_RTYPE_NXDOMAIN, DNS_RRL_RTYPE_QUERY, DNS_RRL_RTYPE_REFERRAL, DNS_RRL_RTYPE_TCP, dns_rrl::exempt, free_qname(), get_entry(), INSIST, ISC_FALSE, isc_log_wouldlog(), isc_log_write(), isc_netaddr_fromsockaddr(), ISC_R_SUCCESS, ISC_TRUE, dns_rrl::last_logged, dns_rrl::lock, LOCK, dns_rrl::log_only, dns_rrl_entry::log_secs, log_stops(), dns_rrl::log_stops_time, dns_rrl_entry::logged, make_log_buf(), dns_rrl::num_logged, dns_rrl::qps, dns_rrl::qps_responses, dns_rrl::qps_scale, dns_rrl::qps_time, dns_rrl_rate::r, dns_rrl_entry::responses, dns_view::rrl, set_age(), UNLOCK, and dns_rrl::window.

Referenced by ns_client_error(), and query_find().

void dns_rrl_view_destroy ( dns_view_t view  ) 

Definition at line 1242 of file rrl.c.

References dns_rrl_hash::bins, DESTROYLOCK, dns_acl_detach(), DNS_RRL_LOG_BUF_LEN, DNS_RRL_QNAMES, dns_rrl::exempt, dns_rrl::hash, ISC_INT32_MAX, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, isc_mem_putanddetach, dns_rrl_hash::length, dns_rrl::lock, log_stops(), dns_rrl::mctx, dns_rrl::num_logged, dns_rrl::old_hash, dns_rrl::qnames, dns_view::rrl, and dns_rrl_block::size.

Referenced by configure_rrl(), destroy(), and dns_rrl_init().

isc_result_t dns_rrl_init ( dns_rrl_t **  rrlp,
dns_view_t view,
int  min_entries 
)

Definition at line 1292 of file rrl.c.

References dns_rrl_view_destroy(), expand_entries(), expand_rrl_hash(), isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_stdtime_get(), dns_rrl::lock, dns_rrl::mctx, dns_view::mctx, dns_view::rrl, and dns_rrl::ts_bases.

Referenced by configure_rrl().


Generated on Tue Apr 28 17:41:10 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha