summaryrefslogtreecommitdiffstats
path: root/src/vat
AgeCommit message (Expand)AuthorFilesLines
2020-09-28virtio: add packet buffering on txMohsin Kazmi1-1/+3
2020-09-22lisp: Move to pluginNeale Ranns1-5028/+0
2020-09-21geneve: Move to pluginNeale Ranns1-1/+0
2020-09-21misc: Move l2tp to pluginNeale Ranns1-324/+0
2020-09-21lldp: Move to pluginNeale Ranns1-105/+0
2020-09-18vat: add infrastructure to align vnet test code and plugin test codeOle Troan4-383/+53
2020-09-11lisp: fix spelling mistake in option nameOnong Tayeng1-1/+1
2020-09-10lisp: fix vat crash with one_add_del_local_eid apiOnong Tayeng1-1/+1
2020-09-02bonding: add bond_create2 API to include gso optionSteven Luong1-0/+107
2020-09-02virtio: add virtio 1.1 api flagsMohsin Kazmi1-11/+51
2020-09-02tap: add virtio 1.1 API flagMohsin Kazmi1-1/+5
2020-08-25flow: add vnet/flow formal APIChenmin Sun1-2/+4
2020-08-14gso: packet coalesce libraryMohsin Kazmi1-0/+41
2020-07-28bonding lacp: replace slave string with memberSteven Luong1-41/+55
2020-07-16adl: move allow/deny list function to pluginDave Barach1-2/+1
2020-06-23vlib: debug CLI macro expander, part deuxDave Barach1-1/+3
2020-06-19vlib: add recursive macro expander to debug cliDave Barach2-3/+3
2020-06-16virtio: add vhost sw_if_index filter for sw_interface_vhost_user_dumpSteven Luong1-2/+15
2020-06-01ip: fix IPv6 mask to prefix length conversionAndreas Schultz1-10/+5
2020-05-29lisp: fix api_format referencePaul Vinciguerra1-2/+2
2020-05-29lisp: fix api_formatFlorin Coras1-6/+6
2020-05-29lisp: fix custom dumpFlorin Coras1-1/+1
2020-05-04misc: binary api fuzz test fixesDave Barach1-2/+2
2020-05-04tap: refactor existing flagsMohsin Kazmi1-6/+10
2020-04-28lisp: API cleanupJakub Grajciar1-313/+243
2020-04-27virtio: support virtio 1.1 packed ring in vhostSteven Luong1-2/+10
2020-04-21vat: fix increment_address(...)Dave Barach1-2/+2
2020-04-17vat: fix static analysis warningAndreas Schultz1-2/+1
2020-04-14vat: fix socket connectionDave Barach1-0/+3
2020-04-07vat: fix vat strncpy stringop-overflowRay Kinsella1-2/+1
2020-04-06vat: fix static analysis warningDave Barach1-2/+3
2020-04-02ipsec: provide stat index in sa detailsMatthew Smith1-2/+3
2020-04-02misc: fix static analysis warningsDave Barach1-1/+1
2020-03-23sr: srv6 API cleanupJakub Grajciar1-10/+5
2020-03-21vlib: leave SIGPROF signal with its default handlerJieqiang Wang1-0/+1
2020-03-19ip: change ip API enums address_family and ip_proto size to u8Jakub Grajciar1-1/+1
2020-03-17ip: ip_address_t uses ip46_address_tNeale Ranns2-0/+533
2020-03-16vxlan: vxlan/vxlan.api API cleanupJakub Grajciar1-13/+15
2020-03-12policer: API cleanupJakub Grajciar1-24/+24
2020-03-05session: API cleanupJakub Grajciar1-29/+47
2020-03-05tap: add support for persistanceMohsin Kazmi1-1/+5
2020-03-04vxlan: vxlan-gpe/vxlan-gpe.cpi API cleanupJakub Grajciar1-66/+29
2020-02-26vat: add ip api types parser definitionsJakub Grajciar4-1/+34
2020-02-26lldp: API cleanupJakub Grajciar1-2/+2
2020-02-26pg: API cleanupJakub Grajciar1-6/+2
2020-02-26sr: API cleanupJakub Grajciar1-1/+1
2020-02-26api: improve api string safetyJakub Grajciar1-12/+7
2020-02-15tap: fix the default parameter for num_rx_queuesMohsin Kazmi1-31/+48
2020-01-30misc: deprecate netmap and ixge driversDamjan Marion1-101/+0
2020-01-16misc: binary-api sw_interface_vhost_user_dump is brokenSteven Luong1-0/+1
\n%U", format_igmp_header, t->packet_data, sizeof (t->packet_data)); return s; } static u8 * format_igmp_parse_report_trace (u8 * s, va_list * va) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *); igmp_input_trace_t *t = va_arg (*va, igmp_input_trace_t *); s = format (s, "sw_if_index %u next-index %u", t->sw_if_index, t->next_index); s = format (s, "\n%U", format_igmp_report_v3, t->packet_data, sizeof (t->packet_data)); return s; } static u8 * format_igmp_parse_query_trace (u8 * s, va_list * va) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *); igmp_input_trace_t *t = va_arg (*va, igmp_input_trace_t *); s = format (s, "sw_if_index %u next-input %u", t->sw_if_index, t->next_index); s = format (s, "\n%U", format_igmp_query_v3, t->packet_data, sizeof (t->packet_data)); return s; } static uword igmp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { igmp_parse_query_next_t next_index; u32 n_left_from, *from, *to_next; vlib_node_runtime_t *error_node; u8 error; error = IGMP_ERROR_NONE; error_node = node; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; while (n_left_from > 0) { u32 n_left_to_next; vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); while (n_left_from > 0 && n_left_to_next > 0) { igmp_header_t *igmp; u16 checksum, csum; vlib_buffer_t *b; ip4_header_t *ip; ip_csum_t sum; u32 bi, next; next = IGMP_INPUT_NEXT_DROP; bi = from[0]; to_next[0] = bi; from++; to_next++; n_left_from--; n_left_to_next--; b = vlib_get_buffer (vm, bi); ip = vlib_buffer_get_current (b); if (ip->protocol != IP_PROTOCOL_IGMP) { error = IGMP_ERROR_INVALID_PROTOCOL; next = IGMP_INPUT_NEXT_DROP; goto next_buffer; } vlib_buffer_advance (b, ip4_header_bytes (ip)); igmp = vlib_buffer_get_current (b); checksum = igmp->checksum; igmp->checksum = 0; sum = ip_incremental_checksum (0, igmp, clib_net_to_host_u16 (ip->length) - ip4_header_bytes (ip)); igmp->checksum = checksum; csum = ~ip_csum_fold (sum); if (checksum != csum) { error = IGMP_ERROR_BAD_CHECKSUM; next = IGMP_INPUT_NEXT_DROP; goto next_buffer; } if (!igmp_config_lookup (vnet_buffer (b)->sw_if_index[VLIB_RX])) { error = IGMP_ERROR_NOT_ENABLED; next = IGMP_INPUT_NEXT_DROP; goto next_buffer; } /* TODO: IGMPv2 and IGMPv1 */ switch (igmp->type) { case IGMP_TYPE_membership_query: next = IGMP_INPUT_NEXT_PARSE_QUERY; break; case IGMP_TYPE_membership_report_v3: next = IGMP_INPUT_NEXT_PARSE_REPORT; break; default: error = IGMP_ERROR_UNKNOWN_TYPE; next = IGMP_INPUT_NEXT_DROP; break; } next_buffer: b->error = error_node->errors[error]; if (node->flags & VLIB_NODE_FLAG_TRACE) { igmp_input_trace_t *tr; tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next; tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b), sizeof (tr->packet_data)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, bi, next); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (igmp_input_node) = { .function = igmp_input, .name = "igmp-input", .vector_size = sizeof (u32), .format_buffer = format_igmp_header, .format_trace = format_igmp_input_trace, .n_errors = IGMP_N_ERROR, .error_strings = igmp_error_strings, .n_next_nodes = IGMP_INPUT_N_NEXT, .next_nodes = { [IGMP_INPUT_NEXT_DROP] = "error-drop", [IGMP_INPUT_NEXT_PARSE_QUERY] = "igmp-parse-query", [IGMP_INPUT_NEXT_PARSE_REPORT] = "igmp-parse-report", } }; /* *INDENT-ON* */ static uword igmp_parse_query (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { u32 n_left_from, *from, *to_next; igmp_parse_query_next_t next_index; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; while (n_left_from > 0) { u32 n_left_to_next; vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); while (n_left_from > 0 && n_left_to_next > 0) { igmp_membership_query_v3_t *igmp; igmp_query_args_t *args; u32 bi, next, len; vlib_buffer_t *b; next = IGMP_PARSE_QUERY_NEXT_DROP; bi = from[0]; to_next[0] = bi; from++; to_next++; n_left_from--; n_left_to_next--; b = vlib_get_buffer (vm, bi); igmp = vlib_buffer_get_current (b); ASSERT (igmp->header.type == IGMP_TYPE_membership_query); if (node->flags & VLIB_NODE_FLAG_TRACE) { igmp_input_trace_t *tr; tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next; tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b), sizeof (tr->packet_data)); } len = igmp_membership_query_v3_length (igmp); /* * validate that the length on the packet on the wire * corresponds to the length on the calculated v3 query */ if (vlib_buffer_length_in_chain (vm, b) == len) { /* * copy the contents of the query, and the interface, over * to the main thread for processing */ vlib_buffer_advance (b, -sizeof (u32)); args = vlib_buffer_get_current (b); args->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; vl_api_rpc_call_main_thread (igmp_handle_query, (u8 *) args, sizeof (*args) + len); } /* * else a packet that is reporting more or less sources * than it really has, bin it */ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, bi, next); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (igmp_parse_query_node) = { .function = igmp_parse_query, .name = "igmp-parse-query", .vector_size = sizeof (u32), .format_buffer = format_igmp_query_v3, .format_trace = format_igmp_parse_query_trace, .n_errors = IGMP_N_ERROR, .error_strings = igmp_error_strings, .n_next_nodes = IGMP_PARSE_QUERY_N_NEXT, .next_nodes = { [IGMP_PARSE_QUERY_NEXT_DROP] = "error-drop", } }; /* *INDENT-ON* */ static uword igmp_parse_report (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { u32 n_left_from, *from, *to_next; igmp_input_next_t next_index; vlib_node_runtime_t *error_node = vlib_node_get_runtime (vm, igmp_input_node.index); u8 error; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; while (n_left_from > 0) { u32 n_left_to_next; vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); while (n_left_from > 0 && n_left_to_next > 0) { igmp_membership_report_v3_t *igmp; igmp_report_args_t *args; u32 bi, next, len; vlib_buffer_t *b; next = IGMP_PARSE_REPORT_NEXT_DROP; bi = from[0]; to_next[0] = bi; from++; to_next++; n_left_from--; n_left_to_next--; b = vlib_get_buffer (vm, bi); error = IGMP_ERROR_NONE; b->error = error_node->errors[error]; igmp = vlib_buffer_get_current (b); len = igmp_membership_report_v3_length (igmp); ASSERT (igmp->header.type == IGMP_TYPE_membership_report_v3); if (node->flags & VLIB_NODE_FLAG_TRACE) { igmp_input_trace_t *tr; tr = vlib_add_trace (vm, node, b, sizeof (*tr)); tr->next_index = next; tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b), sizeof (tr->packet_data)); } /* * validate that the length on the packet on the wire * corresponds to the length on the calculated v3 query */ if (vlib_buffer_length_in_chain (vm, b) == len) { /* * copy the contents of the query, and the interface, over * to the main thread for processing */ vlib_buffer_advance (b, -sizeof (u32)); args = vlib_buffer_get_current (b); args->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; vl_api_rpc_call_main_thread (igmp_handle_report, (u8 *) args, sizeof (*args) + len); } /* * else * this is a packet with more groups/sources than the * header reports. bin it */ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, bi, next); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (igmp_parse_report_node) = { .function = igmp_parse_report, .name = "igmp-parse-report", .vector_size = sizeof (u32), .format_buffer = format_igmp_report_v3, .format_trace = format_igmp_parse_report_trace, .n_errors = IGMP_N_ERROR, .error_strings = igmp_error_strings, .n_next_nodes = IGMP_PARSE_REPORT_N_NEXT, .next_nodes = { [IGMP_PARSE_REPORT_NEXT_DROP] = "error-drop", } }; /* *INDENT-ON* */ static clib_error_t * igmp_input_init (vlib_main_t * vm) { clib_error_t *error; if ((error = vlib_call_init_function (vm, igmp_init))) return error; ip4_register_protocol (IP_PROTOCOL_IGMP, igmp_input_node.index); IGMP_DBG ("input-initialized"); return (error); } VLIB_INIT_FUNCTION (igmp_input_init); /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */