unbound: util/edns.c File Reference

unbound 0.1

Functions
edns.c File Reference

This file contains functions for base EDNS options. More...

`#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_strings * | edns_strings_create (void)
| Create structure to hold EDNS strings.
void | edns_strings_delete (struct edns_strings *edns_strings)
| Delete EDNS strings structure.
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.
struct edns_string_addr * | edns_string_addr_lookup (rbtree_type *tree, struct sockaddr_storage *addr, socklen_t addrlen)
| Find string for address.

## 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 daemon_init(), and ub_ctx_create_nopipe().

## ◆ edns_strings_delete()

void edns_strings_delete | ( | struct edns_strings * | edns_strings | ) |

Delete EDNS strings structure.

Parameters

  edns_strings | struct 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_strings | edns strings to apply config to
  config | struct containing EDNS strings configuration

Returns
  0 on error

References addr_tree_init(), addr_tree_init_parents(), edns_strings::client_string_opcode, edns_strings::client_strings, config_file::edns_client_string_opcode, 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(), and daemon_fork().

## ◆ 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

  tree | tree containing EDNS strings per address prefix.
  addr | address to use for tree lookup
  addrlen | length of address

Returns
  : matching tree node, NULL otherwise

References addr_tree_lookup().

Referenced by outnet_serviced_query().