edns.c File Reference
#include "config.h"
#include "util/edns.h"
#include "util/config_file.h"
#include "util/netevent.h"
#include "util/net_help.h"
#include "util/regional.h"
#include "util/data/msgparse.h"
#include "util/data/msgreply.h"

Functions

struct edns_stringsedns_strings_create (void)
 Create structure to hold EDNS strings. More...
 
void edns_strings_delete (struct edns_strings *edns_strings)
 Delete EDNS strings structure. More...
 
static int edns_strings_client_insert (struct edns_strings *edns_strings, struct sockaddr_storage *addr, socklen_t addrlen, int net, const char *string)
 
int edns_strings_apply_cfg (struct edns_strings *edns_strings, struct config_file *config)
 Add configured EDNS strings. More...
 
struct edns_string_addredns_string_addr_lookup (rbtree_type *tree, struct sockaddr_storage *addr, socklen_t addrlen)
 Find string for address. More...
 

Detailed Description

This file contains functions for base EDNS options.

Function Documentation

◆ edns_strings_create()

struct edns_strings* edns_strings_create ( void  )

Create structure to hold EDNS strings.

Returns
: newly created edns_strings, NULL on alloc failure.

References edns_strings_delete(), edns_strings::region, and regional_create().

Referenced by ub_ctx_create_nopipe().

◆ edns_strings_delete()

void edns_strings_delete ( struct edns_strings edns_strings)

Delete EDNS strings structure.

Parameters
edns_stringsstruct to delete

References edns_strings::region, and regional_destroy().

Referenced by daemon_delete(), edns_strings_create(), ub_ctx_create(), and ub_ctx_delete().

◆ edns_strings_apply_cfg()

int edns_strings_apply_cfg ( struct edns_strings edns_strings,
struct config_file config 
)

Add configured EDNS strings.

Parameters
edns_stringsedns strings to apply config to
configstruct containing EDNS strings configuration
Returns
0 on error

References addr_tree_init(), edns_strings::client_strings, config_file::edns_client_strings, log_assert, log_err(), netblockstrtoaddr(), config_str2list::next, edns_strings::region, regional_free_all(), config_str2list::str, and config_str2list::str2.

Referenced by context_finalize().

◆ edns_string_addr_lookup()

struct edns_string_addr* edns_string_addr_lookup ( rbtree_type tree,
struct sockaddr_storage *  addr,
socklen_t  addrlen 
)

Find string for address.

Parameters
treetree containing EDNS strings per address prefix.
addraddress to use for tree lookup
addrlenlength of address
Returns
: matching tree node, NULL otherwise

References addr_tree_lookup().

Referenced by outnet_serviced_query().