typedef enum
{
DNS46_REPLY_NEXT_DROP,
+ DNS46_REPLY_NEXT_PUNT,
DNS46_REPLY_N_NEXT,
} dns46_reply_next_t;
{
u32 n_left_from, *from, *to_next;
dns46_reply_next_t next_index;
+ dns_main_t *dm = &dns_main;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
vlib_buffer_t *b0;
u32 next0 = DNS46_REPLY_NEXT_DROP;
dns_header_t *d0;
- u32 pool_index0;
- u32 error0;
+ u32 pool_index0 = ~0;
+ u32 error0 = 0;
u8 *resp0 = 0;
/* speculatively enqueue b0 to the current next frame */
from += 1;
to_next += 1;
n_left_from -= 1;
-
n_left_to_next -= 1;
b0 = vlib_get_buffer (vm, bi0);
d0 = vlib_buffer_get_current (b0);
+ if (PREDICT_FALSE (dm->is_enabled == 0))
+ {
+ next0 = DNS46_REPLY_NEXT_PUNT;
+ error0 = DNS46_REPLY_ERROR_DISABLED;
+ goto done0;
+ }
pool_index0 = clib_host_to_net_u16 (d0->id);
/* Save the reply */
vec_validate (resp0, vlib_buffer_length_in_chain (vm, b0) - 1);
- clib_memcpy (resp0, d0, vlib_buffer_length_in_chain (vm, b0));
+ clib_memcpy_fast (resp0, d0, vlib_buffer_length_in_chain (vm, b0));
/*
* Deal with everything in process ctx on the main thread
(uword) resp0);
error0 = DNS46_REPLY_ERROR_PROCESSED;
+ done0:
b0->error = node->errors[error0];
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
return frame->n_vectors;
}
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (dns46_reply_node) =
{
- .function = dns46_reply_node_fn,.name = "dns46_reply",.vector_size =
- sizeof (u32),.format_trace = format_dns46_reply_trace,.type =
- VLIB_NODE_TYPE_INTERNAL,.n_errors =
- ARRAY_LEN (dns46_reply_error_strings),.error_strings =
- dns46_reply_error_strings,.n_next_nodes = DNS46_REPLY_N_NEXT,
- /* edit / add dispositions here */
- .next_nodes =
- {
- [DNS46_REPLY_NEXT_DROP] = "error-drop",}
-,};
+ .function = dns46_reply_node_fn,
+ .name = "dns46_reply",
+ .vector_size = sizeof (u32),
+ .format_trace = format_dns46_reply_trace,
+ .type = VLIB_NODE_TYPE_INTERNAL,
+ .n_errors = ARRAY_LEN (dns46_reply_error_strings),
+ .error_strings = dns46_reply_error_strings,
+ .n_next_nodes = DNS46_REPLY_N_NEXT,
+ .next_nodes = {
+ [DNS46_REPLY_NEXT_DROP] = "error-drop",
+ [DNS46_REPLY_NEXT_PUNT] = "error-punt",
+ },
+};
+/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON