summaryrefslogtreecommitdiffstats
path: root/src/svm
AgeCommit message (Expand)AuthorFilesLines
2020-11-20svm: fix coverity warningFlorin Coras1-6/+7
2020-11-19svm: move chunk locks to linked listFlorin Coras1-37/+48
2020-11-19svm: init chunk rb tree indices in fifoFlorin Coras2-4/+2
2020-11-19svm: fix high segment base address for ASanBenoît Ganne1-1/+1
2020-11-18svm: fifo segment cleanupFlorin Coras1-341/+205
2020-11-13svm: change high_seg_basevaNathan Skrzypczak1-2/+2
2020-11-09session: delegate fifo ooo lookup init to transportsFlorin Coras1-6/+0
2020-10-22svm: support large memfd segmentsFlorin Coras1-2/+2
2020-10-21svm: fix ASAN annotations for external chunksBenoît Ganne2-0/+4
2020-10-13svm: fix coverity warningFlorin Coras1-2/+2
2020-10-12vcl svm: segments improvementsFlorin Coras2-10/+22
2020-10-10misc: clib_unix_warning usage errorjiangxiaoming1-4/+4
2020-10-06vppinfra: add heap header in front of dlmalloc spaceDamjan Marion3-9/+8
2020-10-01svm: simplify memfd client segment mappingFlorin Coras1-12/+15
2020-09-30svm: harmonize ssvm namesFlorin Coras3-56/+56
2020-09-30svm session: use new clib mem apis for segmentsFlorin Coras3-46/+69
2020-09-29svm: fix max fifo sizeFlorin Coras1-1/+1
2020-09-29vcl svm: provide apps access to fifo chunksFlorin Coras2-31/+36
2020-09-28vppinfra: don't call dlmalloc API directly from the codeDamjan Marion9-35/+16
2020-09-09svm: fix non-null-terminated stringBenoît Ganne1-1/+1
2020-09-08svm session: document unsupported fifo deq combinationsFlorin Coras2-2/+8
2020-08-06misc: harmonize namesDave Barach2-9/+9
2020-04-28svm: fix fifo alignemnt in batch preallocFlorin Coras1-3/+9
2020-04-28svm: null instead of panic if fifo hdr alloc failsFlorin Coras1-1/+4
2020-04-22svm: asan: fix asan supportBenoît Ganne2-0/+11
2020-04-20svm: check if fifo free list index is valid on allocFlorin Coras2-0/+9
2020-04-09session: update fifo slice on session migrationFlorin Coras2-14/+79
2020-04-09svm: use active fifo count in fifo testFlorin Coras1-12/+8
2020-04-02misc: fix static analysis warningsDave Barach1-3/+3
2020-03-27vcl: support for uword segmentsFlorin Coras1-1/+1
2020-03-26svm: correct format_fifo_segmentRyujiro Shibuya1-3/+4
2020-03-16svm: chunk alloc statsRyujiro Shibuya2-5/+13
2020-03-12svm: cleanup chunk and fifo allocationFlorin Coras1-37/+62
2020-03-09svm: track fifo segment virtual memory consumptionFlorin Coras3-38/+69
2020-03-05session: reduce segment reserved bytesFlorin Coras1-3/+2
2020-03-05session: fix segment search on fifo allocFlorin Coras2-0/+8
2020-02-29svm: add explicit dependency on lock for fifo typesFlorin Coras1-0/+1
2020-02-29svm: fix slice locking on fifo allocFlorin Coras1-5/+15
2020-02-26svm: fix coverity warningsFlorin Coras1-1/+0
2020-02-26tls session: fix unlistenFlorin Coras1-1/+0
2020-02-26svm: support multi-chunk fifo chunk allocFlorin Coras1-7/+133
2020-02-26svm: remove chunk add functionFlorin Coras4-53/+98
2020-02-25svm: minimal initial fifoFlorin Coras3-11/+12
2020-02-25session svm: tracking segment memory usageRyujiro Shibuya3-13/+208
2020-02-25svm: refactor fifoFlorin Coras6-881/+782
2020-02-25svm: refactor fifo chunk trackingFlorin Coras3-82/+294
2020-02-11vppinfra: remove the historical mheap memory allocatorDave Barach3-49/+0
2020-02-11svm: numa awareness for ssvm segmentsFlorin Coras2-25/+30
2020-01-31session: fix chunk batch alloc for large fifosFlorin Coras1-6/+8
2020-01-08svm: fix eventfd signal write error checkFlorin Coras1-2/+2
private_key, port, &src_ip, &sw_if_index); if (rv) return clib_error_return (0, "wireguard interface create failed"); vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main (), sw_if_index); return 0; } /*? * Create a Wireguard interface. ?*/ VLIB_CLI_COMMAND (wg_if_create_command, static) = { .path = "wireguard create", .short_help = "wireguard create listen-port <port> " "private-key <key> src <IP> [generate-key]", .function = wg_if_create_cli, }; static clib_error_t * wg_if_delete_cli (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { wg_main_t *wmp = &wg_main; vnet_main_t *vnm; u32 sw_if_index; int rv; wg_feature_init (wmp); vnm = vnet_get_main (); sw_if_index = ~0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index)) ; else break; } if (~0 != sw_if_index) { rv = wg_if_delete (sw_if_index); if (rv) return clib_error_return (0, "wireguard interface delete failed"); } else return clib_error_return (0, "no such interface: %U", format_unformat_error, input); return 0; } /*? * Delete a Wireguard interface. ?*/ VLIB_CLI_COMMAND (wg_if_delete_command, static) = { .path = "wireguard delete", .short_help = "wireguard delete <interface>", .function = wg_if_delete_cli, }; static clib_error_t * wg_peer_add_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vnet_main_t *vnm = vnet_get_main (); wg_main_t *wmp = &wg_main; clib_error_t *error = NULL; unformat_input_t _line_input, *line_input = &_line_input; u8 *public_key_64 = 0; u8 public_key[NOISE_PUBLIC_KEY_LEN + 1]; fib_prefix_t allowed_ip, *allowed_ips = NULL; ip_prefix_t pfx; ip_address_t ip = ip_address_initializer; u32 portDst = 0, table_id = 0; u32 persistent_keepalive = 0; u32 tun_sw_if_index = ~0; u32 peer_index; int rv; if (!unformat_user (input, unformat_line_input, line_input)) return 0; wg_feature_init (wmp); while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { if (unformat (line_input, "public-key %s", &public_key_64)) { if (!(key_from_base64 (public_key_64, NOISE_KEY_LEN_BASE64, public_key))) { error = clib_error_return (0, "Error parsing private key"); goto done; } } else if (unformat (line_input, "endpoint %U", unformat_ip_address, &ip)) ; else if (unformat (line_input, "table-id %d", &table_id)) ; else if (unformat (line_input, "dst-port %d", &portDst)) ; else if (unformat (line_input, "persistent-keepalive %d", &persistent_keepalive)) ; else if (unformat (line_input, "allowed-ip %U", unformat_ip_prefix, &pfx)) { ip_prefix_to_fib_prefix (&pfx, &allowed_ip); vec_add1 (allowed_ips, allowed_ip); } else if (unformat (line_input, "%U", unformat_vnet_sw_interface, vnm, &tun_sw_if_index)) ; else { error = clib_error_return (0, "Input error"); goto done; } } if (0 == vec_len (allowed_ips)) { error = clib_error_return (0, "Allowed IPs are not specified"); goto done; } rv = wg_peer_add (tun_sw_if_index, public_key, table_id, &ip_addr_46 (&ip), allowed_ips, portDst, persistent_keepalive, &peer_index); switch (rv) { case VNET_API_ERROR_KEY_LENGTH: error = clib_error_return (0, "Error parsing public key"); break; case VNET_API_ERROR_ENTRY_ALREADY_EXISTS: error = clib_error_return (0, "Peer already exist"); break; case VNET_API_ERROR_INVALID_SW_IF_INDEX: error = clib_error_return (0, "Tunnel is not specified"); break; case VNET_API_ERROR_LIMIT_EXCEEDED: error = clib_error_return (0, "Max peers limit"); break; case VNET_API_ERROR_INIT_FAILED: error = clib_error_return (0, "wireguard device parameters is not set"); break; case VNET_API_ERROR_INVALID_PROTOCOL: error = clib_error_return (0, "ipv6 not supported yet"); break; } done: vec_free (public_key_64); vec_free (allowed_ips); unformat_free (line_input); return error; } VLIB_CLI_COMMAND (wg_peer_add_command, static) = { .path = "wireguard peer add", .short_help = "wireguard peer add <wg_int> public-key <pub_key_other> " "endpoint <ip4_dst> allowed-ip <prefix> " "dst-port [port_dst] persistent-keepalive [keepalive_interval]", .function = wg_peer_add_command_fn, }; static clib_error_t * wg_peer_remove_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { wg_main_t *wmp = &wg_main; clib_error_t *error = NULL; u32 peer_index; int rv; unformat_input_t _line_input, *line_input = &_line_input; if (!unformat_user (input, unformat_line_input, line_input)) return 0; wg_feature_init (wmp); if (unformat (line_input, "%d", &peer_index)) ; else { error = clib_error_return (0, "Input error"); goto done; } rv = wg_peer_remove (peer_index); switch (rv) { case VNET_API_ERROR_KEY_LENGTH: error = clib_error_return (0, "Error parsing public key"); break; } done: unformat_free (line_input); return error; } VLIB_CLI_COMMAND (wg_peer_remove_command, static) = { .path = "wireguard peer remove", .short_help = "wireguard peer remove <index>", .function = wg_peer_remove_command_fn, }; static walk_rc_t wg_peer_show_one (index_t peeri, void *arg) { vlib_cli_output (arg, "%U", format_wg_peer, peeri); return (WALK_CONTINUE); } static clib_error_t * wg_show_peer_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { wg_peer_walk (wg_peer_show_one, vm); return NULL; } VLIB_CLI_COMMAND (wg_show_peers_command, static) = { .path = "show wireguard peer", .short_help = "show wireguard peer", .function = wg_show_peer_command_fn, }; static walk_rc_t wg_if_show_one (index_t itfi, void *arg) { vlib_cli_output (arg, "%U", format_wg_if, itfi); return (WALK_CONTINUE); } static clib_error_t * wg_show_if_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { wg_main_t *wmp = &wg_main; wg_feature_init (wmp); wg_if_walk (wg_if_show_one, vm); return NULL; } VLIB_CLI_COMMAND (wg_show_itfs_command, static) = { .path = "show wireguard interface", .short_help = "show wireguard", .function = wg_show_if_command_fn, }; static clib_error_t * wg_set_async_mode_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd) { unformat_input_t _line_input, *line_input = &_line_input; int async_enable = 0; if (!unformat_user (input, unformat_line_input, line_input)) return 0; while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { if (unformat (line_input, "on")) async_enable = 1; else if (unformat (line_input, "off")) async_enable = 0; else return (clib_error_return (0, "unknown input '%U'", format_unformat_error, line_input)); } wg_set_async_mode (async_enable); unformat_free (line_input); return (NULL); } VLIB_CLI_COMMAND (wg_set_async_mode_command, static) = { .path = "set wireguard async mode", .short_help = "set wireguard async mode on|off", .function = wg_set_async_mode_command_fn, }; static clib_error_t * wg_show_mode_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd) { vlib_cli_output (vm, "Wireguard mode"); #define _(v, f, s) \ vlib_cli_output (vm, "\t%s: %s", s, \ (wg_op_mode_is_set_##f () ? "enabled" : "disabled")); foreach_wg_op_mode_flags #undef _ return (NULL); } VLIB_CLI_COMMAND (wg_show_modemode_command, static) = { .path = "show wireguard mode", .short_help = "show wireguard mode", .function = wg_show_mode_command_fn, }; /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */