FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
dns.c File Reference
+ Include dependency graph for dns.c:

Go to the source code of this file.

Macros

#define vl_typedefs   /* define message structures */
 
#define vl_endianfun   /* define message structures */
 
#define vl_print(handle, ...)   vlib_cli_output (handle, __VA_ARGS__)
 
#define vl_printfun
 
#define foreach_notification_to_move   _(pending_requests)
 
#define vl_msg_name_crc_list
 
#define foreach_dns_api_msg
 
#define DNS_FORMAT_TEST   0
 

Functions

static int dns_cache_clear (dns_main_t *dm)
 
static int dns_enable_disable (dns_main_t *dm, int is_enable)
 
static void vl_api_dns_enable_disable_t_handler (vl_api_dns_enable_disable_t *mp)
 
static int dns6_name_server_add_del (dns_main_t *dm, u8 *server_address_as_u8, int is_add)
 
static int dns4_name_server_add_del (dns_main_t *dm, u8 *server_address_as_u8, int is_add)
 
static void vl_api_dns_name_server_add_del_t_handler (vl_api_dns_name_server_add_del_t *mp)
 
static void send_dns4_request (dns_main_t *dm, dns_cache_entry_t *ep, ip4_address_t *server)
 
static void send_dns6_request (dns_main_t *dm, dns_cache_entry_t *ep, ip6_address_t *server)
 
u8name_to_labels (u8 *name)
 Translate "foo.com" into "0x3 f o o 0x3 c o m 0x0" A historical / hysterical micro-TLV scheme. More...
 
u8vnet_dns_labels_to_name (u8 *label, u8 *full_text, u8 **parse_from_here)
 arc-function for the above. More...
 
void vnet_send_dns_request (dns_main_t *dm, dns_cache_entry_t *ep)
 
int vnet_dns_delete_entry_by_index_nolock (dns_main_t *dm, u32 index)
 
static int dns_delete_by_name (dns_main_t *dm, u8 *name)
 
static int delete_random_entry (dns_main_t *dm)
 
static int dns_add_static_entry (dns_main_t *dm, u8 *name, u8 *dns_reply_data)
 
int vnet_dns_resolve_name (dns_main_t *dm, u8 *name, dns_pending_request_t *t, dns_cache_entry_t **retp)
 
int vnet_dns_cname_indirection_nolock (dns_main_t *dm, u32 ep_index, u8 *reply)
 Handle cname indirection. More...
 
int vnet_dns_response_to_reply (u8 *response, vl_api_dns_resolve_name_reply_t *rmp, u32 *min_ttlp)
 
int vnet_dns_response_to_name (u8 *response, vl_api_dns_resolve_ip_reply_t *rmp, u32 *min_ttlp)
 
static void vl_api_dns_resolve_name_t_handler (vl_api_dns_resolve_name_t *mp)
 
static void vl_api_dns_resolve_ip_t_handler (vl_api_dns_resolve_ip_t *mp)
 
static void setup_message_id_table (api_main_t *am)
 
static clib_error_tdns_api_hookup (vlib_main_t *vm)
 
 VLIB_API_INIT_FUNCTION (dns_api_hookup)
 
static clib_error_tdns_config_fn (vlib_main_t *vm, unformat_input_t *input)
 
static clib_error_tdns_init (vlib_main_t *vm)
 
uword unformat_dns_reply (unformat_input_t *input, va_list *args)
 
u8format_dns_query (u8 *s, va_list *args)
 
u8format_dns_reply_data (u8 *s, va_list *args)
 format dns reply data verbose > 1, dump everything verbose == 1, dump all A and AAAA records verbose == 0, dump one A record, and one AAAA record More...
 
u8format_dns_reply (u8 *s, va_list *args)
 
u8format_dns_cache (u8 *s, va_list *args)
 
static clib_error_tshow_dns_cache_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tdns_cache_add_del_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
void vnet_send_dns6_reply (dns_main_t *dm, dns_pending_request_t *pr, dns_cache_entry_t *ep, vlib_buffer_t *b0)
 
void vnet_send_dns4_reply (dns_main_t *dm, dns_pending_request_t *pr, dns_cache_entry_t *ep, vlib_buffer_t *b0)
 

Variables

dns_main_t dns_main
 
vlib_cli_command_t show_dns_cache_command
 (constructor) VLIB_CLI_COMMAND (show_dns_cache_command) More...
 
vlib_cli_command_t dns_cache_add_del_command
 (constructor) VLIB_CLI_COMMAND (dns_cache_add_del_command) More...
 

Macro Definition Documentation

#define DNS_FORMAT_TEST   0

Definition at line 2320 of file dns.c.

#define foreach_dns_api_msg
Value:
_(DNS_ENABLE_DISABLE, dns_enable_disable) \
_(DNS_NAME_SERVER_ADD_DEL, dns_name_server_add_del) \
_(DNS_RESOLVE_NAME, dns_resolve_name) \
_(DNS_RESOLVE_IP, dns_resolve_ip)
static int dns_enable_disable(dns_main_t *dm, int is_enable)
Definition: dns.c:71

Definition at line 1481 of file dns.c.

#define foreach_notification_to_move   _(pending_requests)

Definition at line 910 of file dns.c.

#define vl_endianfun   /* define message structures */

Definition at line 30 of file dns.c.

#define vl_msg_name_crc_list

Definition at line 1469 of file dns.c.

#define vl_print (   handle,
  ... 
)    vlib_cli_output (handle, __VA_ARGS__)

Definition at line 35 of file dns.c.

#define vl_printfun

Definition at line 36 of file dns.c.

#define vl_typedefs   /* define message structures */

Definition at line 26 of file dns.c.

Function Documentation

static int delete_random_entry ( dns_main_t dm)
static

Definition at line 677 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int dns4_name_server_add_del ( dns_main_t dm,
u8 server_address_as_u8,
int  is_add 
)
static

Definition at line 150 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int dns6_name_server_add_del ( dns_main_t dm,
u8 server_address_as_u8,
int  is_add 
)
static

Definition at line 114 of file dns.c.

+ Here is the caller graph for this function:

static int dns_add_static_entry ( dns_main_t dm,
u8 name,
u8 dns_reply_data 
)
static

Definition at line 724 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dns_api_hookup ( vlib_main_t vm)
static

Definition at line 1488 of file dns.c.

+ Here is the call graph for this function:

static clib_error_t* dns_cache_add_del_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2220 of file dns.c.

+ Here is the call graph for this function:

static int dns_cache_clear ( dns_main_t dm)
static

Definition at line 45 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dns_config_fn ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 1508 of file dns.c.

+ Here is the call graph for this function:

static int dns_delete_by_name ( dns_main_t dm,
u8 name 
)
static

Definition at line 654 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int dns_enable_disable ( dns_main_t dm,
int  is_enable 
)
static

Definition at line 71 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dns_init ( vlib_main_t vm)
static

Definition at line 1528 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dns_cache ( u8 s,
va_list *  args 
)

Definition at line 2049 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dns_query ( u8 s,
va_list *  args 
)

Definition at line 1659 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dns_reply ( u8 s,
va_list *  args 
)

Definition at line 1989 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dns_reply_data ( u8 s,
va_list *  args 
)

format dns reply data verbose > 1, dump everything verbose == 1, dump all A and AAAA records verbose == 0, dump one A record, and one AAAA record

Definition at line 1723 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* name_to_labels ( u8 name)

Translate "foo.com" into "0x3 f o o 0x3 c o m 0x0" A historical / hysterical micro-TLV scheme.

DGMS.

Definition at line 430 of file dns.c.

+ Here is the caller graph for this function:

static void send_dns4_request ( dns_main_t dm,
dns_cache_entry_t ep,
ip4_address_t server 
)
static

Definition at line 201 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_dns6_request ( dns_main_t dm,
dns_cache_entry_t ep,
ip6_address_t server 
)
static

Definition at line 317 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void setup_message_id_table ( api_main_t am)
static

Definition at line 1474 of file dns.c.

+ Here is the caller graph for this function:

static clib_error_t* show_dns_cache_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2184 of file dns.c.

+ Here is the call graph for this function:

uword unformat_dns_reply ( unformat_input_t input,
va_list *  args 
)

Definition at line 1555 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_dns_enable_disable_t_handler ( vl_api_dns_enable_disable_t mp)
static

Definition at line 102 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_dns_name_server_add_del_t_handler ( vl_api_dns_name_server_add_del_t mp)
static

Definition at line 186 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_dns_resolve_ip_t_handler ( vl_api_dns_resolve_ip_t mp)
static

Definition at line 1390 of file dns.c.

+ Here is the call graph for this function:

static void vl_api_dns_resolve_name_t_handler ( vl_api_dns_resolve_name_t mp)
static

Definition at line 1346 of file dns.c.

+ Here is the call graph for this function:

VLIB_API_INIT_FUNCTION ( dns_api_hookup  )

+ Here is the caller graph for this function:

int vnet_dns_cname_indirection_nolock ( dns_main_t dm,
u32  ep_index,
u8 reply 
)

Handle cname indirection.

JFC. Called with the cache locked. returns 0 if the reply is not a CNAME.

Definition at line 919 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_dns_delete_entry_by_index_nolock ( dns_main_t dm,
u32  index 
)

Definition at line 620 of file dns.c.

+ Here is the caller graph for this function:

u8* vnet_dns_labels_to_name ( u8 label,
u8 full_text,
u8 **  parse_from_here 
)

arc-function for the above.

Translate "0x3 f o o 0x3 c o m 0x0" into "foo.com" Produces a non-NULL-terminated u8 *vector. v format is your friend.

Definition at line 473 of file dns.c.

+ Here is the caller graph for this function:

int vnet_dns_resolve_name ( dns_main_t dm,
u8 name,
dns_pending_request_t t,
dns_cache_entry_t **  retp 
)

Definition at line 766 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_dns_response_to_name ( u8 response,
vl_api_dns_resolve_ip_reply_t rmp,
u32 min_ttlp 
)

Definition at line 1210 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_dns_response_to_reply ( u8 response,
vl_api_dns_resolve_name_reply_t rmp,
u32 min_ttlp 
)

Definition at line 1069 of file dns.c.

+ Here is the caller graph for this function:

void vnet_send_dns4_reply ( dns_main_t dm,
dns_pending_request_t pr,
dns_cache_entry_t ep,
vlib_buffer_t b0 
)

Definition at line 2652 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vnet_send_dns6_reply ( dns_main_t dm,
dns_pending_request_t pr,
dns_cache_entry_t ep,
vlib_buffer_t b0 
)

Definition at line 2644 of file dns.c.

+ Here is the caller graph for this function:

void vnet_send_dns_request ( dns_main_t dm,
dns_cache_entry_t ep 
)

Definition at line 515 of file dns.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vlib_cli_command_t dns_cache_add_del_command
Initial value:
=
{
.path = "dns cache",
.short_help = "dns cache [add|del|clear] <name> [ip4][ip6]",
}
static clib_error_t * dns_cache_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dns.c:2220

(constructor) VLIB_CLI_COMMAND (dns_cache_add_del_command)

Definition at line 2312 of file dns.c.

dns_main_t dns_main

Definition at line 42 of file dns.c.

vlib_cli_command_t show_dns_cache_command
Initial value:
=
{
.path = "show dns cache",
.short_help = "show dns cache [verbose [nn]]",
}
static clib_error_t * show_dns_cache_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dns.c:2184

(constructor) VLIB_CLI_COMMAND (show_dns_cache_command)

Definition at line 2211 of file dns.c.