dns_walk
facility takes a DNS packet or rdata field, additional information if required, and a set of functions that should be applied to parts of the packet or rdata.
The functions usually make decisions based on the contents (i.e.. filter it). Domains are assembled by combining fragments of "compressed" domains. Parts that are uninteresting for filter, such as MX precedence values, are skipped.
|
typedef const uint8_t | axa_walkb_t |
| A pointer to DNS data. More...
|
|
typedef const char | axa_walks_t |
| DNS section name. More...
|
|
typedef const struct axa_walk_ops | axa_walk_ops_t |
| list of callback functions More...
|
|
typedef void( | axa_walk_error_t) (void *ctxt, const char *p, va_list args) |
| Callback function to deal with an error encountered while parsing a DNS packet or rdata, usually by printing or logging a message. More...
|
|
typedef bool( | axa_walk_ip_t) (void *ctxt, const axa_walkb_t *ip, size_t ip_len, axa_walks_t *sec) |
| Callback function for an IP address found while walking over a DNS packet or rdata. More...
|
|
typedef bool( | axa_walk_domain_t) (void *ctxt, axa_walkb_t *name, size_t name_len, axa_walk_dom_t dtype, uint rtype, axa_walks_t *sec) |
| Callback function for a domain found while walking over a DNS packet or rdata. More...
|
|
typedef bool( | axa_walk_rdata_t) (void *ctxt, axa_walk_ops_t *ops, axa_walkb_t *oname, size_t oname_len, axa_walkb_t *pkt_base, axa_walkb_t *pkt_lim, axa_walkb_t *rdata, size_t rdlength, uint rtype, axa_walks_t *sec) |
| Examine or walk over an owner name and its rdata. More...
|
|
list of callback functions
typedef void( axa_walk_error_t) (void *ctxt, const char *p, va_list args) |
Callback function to deal with an error encountered while parsing a DNS packet or rdata, usually by printing or logging a message.
- Parameters
-
[in] | ctxt | DNS Walk caller's context |
[in] | p | printf message pattern describing the error |
[in] | args | values for p |
Callback function for an IP address found while walking over a DNS packet or rdata.
- Parameters
-
[in] | ctxt | caller's context |
[in] | ip | found IP address |
[in] | ip_len | length of IP and so either 4 or 16 |
[in] | sec | name of the DNS section where the IP address was found |
- Return values
-
true | continue walking |
false | stop walking or parsing after an error or because a filtering decision has been made |
Callback function for a domain found while walking over a DNS packet or rdata.
- Parameters
-
[in] | ctxt | caller's context |
[in] | name | found domain in wire format |
[in] | name_len | length of name |
[in] | dtype | context in which name was found |
[in] | rtype | rtype of owned or containing rdata |
[in] | sec | name of the DNS section where the domain was found |
- Return values
-
true | continue walking |
false | stop walking or parsing after an error or because a filtering decision has been made |
Examine or walk over an owner name and its rdata.
- Parameters
-
[in] | ctxt | caller's context |
[in] | ops | list of callback functions |
[in] | oname | owner name if known or NULL if unknown |
[in] | oname_len | length of owner name |
[in] | pkt_base | start of DNS packet or NULL for isolated rdata |
[in] | pkt_lim | end + 1 of DNS packet or end of rdata+1 |
[in] | rdata | resource data or rdata to walk or examine |
[in] | rdlength | rdata length |
[in] | rtype | resource type or rtype of rdata |
[in] | sec | section name |
- Return values
-
true | continue walking |
false | stop walking or parsing after an error or because a filtering decision has been made |
The context of a domain.
Enumerator |
---|
AXA_WALK_DOM_QUESTION |
DNS question.
|
AXA_WALK_DOM_OWNER |
rdata owner domain
|
AXA_WALK_DOM_RDATA1 |
1st or only domain in rdata
|
AXA_WALK_DOM_RDATA2 |
2nd rdata domain in such as SOA
|
Walk over or examine a DNS packet.
- Parameters
-
[in] | ctxt | caller's context given callback functions |
[in] | ops | list of callback functions |
[in] | pkt_base | start of the DNS packet |
[in] | pkt_len | length of the DNS packet |
Generic rdata callback that calls axa_walk_ops_t->error, ->ip, or ->domain as it walks over rdata.
This function can be used in axa_walk_ops_t explicitly or by setting axa_walk_ops_t->rdata==NULL or called by the function specified in axa_walk_ops_t->rdata. That is useful when external criteria determine whether an rdata field should be examined or skipped.
Generic callback to skip rdata for uses that do not care about an rdata field.