Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #include <vcl/vcl_private.h> |
| 17 | |
| 18 | static int |
| 19 | vcl_api_connect_app_socket (vcl_worker_t * wrk) |
| 20 | { |
| 21 | clib_socket_t *cs = &wrk->app_api_sock; |
| 22 | clib_error_t *err; |
| 23 | int rv = 0; |
| 24 | |
| 25 | cs->config = (char *) vcm->cfg.vpp_app_socket_api; |
Florin Coras | 57e0af9 | 2021-05-26 10:21:10 -0700 | [diff] [blame] | 26 | cs->flags = |
| 27 | CLIB_SOCKET_F_IS_CLIENT | CLIB_SOCKET_F_SEQPACKET | CLIB_SOCKET_F_BLOCKING; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 28 | |
| 29 | wrk->vcl_needs_real_epoll = 1; |
| 30 | |
| 31 | if ((err = clib_socket_init (cs))) |
| 32 | { |
Filip Tehlar | 8ccc6b3 | 2022-02-02 17:38:20 +0000 | [diff] [blame] | 33 | /* don't report the error to avoid flood of error messages during |
| 34 | * reconnect */ |
| 35 | clib_error_free (err); |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 36 | rv = -1; |
| 37 | goto done; |
| 38 | } |
| 39 | |
| 40 | done: |
| 41 | |
| 42 | wrk->vcl_needs_real_epoll = 0; |
| 43 | |
| 44 | return rv; |
| 45 | } |
| 46 | |
| 47 | static int |
| 48 | vcl_api_attach_reply_handler (app_sapi_attach_reply_msg_t * mp, int *fds) |
| 49 | { |
| 50 | vcl_worker_t *wrk = vcl_worker_get_current (); |
| 51 | int i, rv, n_fds_used = 0; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 52 | u64 segment_handle; |
| 53 | u8 *segment_name; |
| 54 | |
| 55 | if (mp->retval) |
| 56 | { |
| 57 | VERR ("attach failed: %U", format_session_error, mp->retval); |
| 58 | goto failed; |
| 59 | } |
| 60 | |
Florin Coras | cc7c88e | 2020-09-15 15:56:51 -0700 | [diff] [blame] | 61 | wrk->api_client_handle = mp->api_client_handle; |
Maros Ondrejicka | 0db1575 | 2022-10-12 22:58:01 +0200 | [diff] [blame^] | 62 | /* reattaching via `vcl_api_retry_attach` wants wrk->vpp_wrk_index to be 0 */ |
| 63 | wrk->vpp_wrk_index = 0; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 64 | segment_handle = mp->segment_handle; |
| 65 | if (segment_handle == VCL_INVALID_SEGMENT_HANDLE) |
| 66 | { |
| 67 | VERR ("invalid segment handle"); |
| 68 | goto failed; |
| 69 | } |
| 70 | |
| 71 | if (!mp->n_fds) |
| 72 | goto failed; |
| 73 | |
| 74 | if (mp->fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT) |
| 75 | if (vcl_segment_attach (vcl_vpp_worker_segment_handle (0), "vpp-mq-seg", |
| 76 | SSVM_SEGMENT_MEMFD, fds[n_fds_used++])) |
| 77 | goto failed; |
| 78 | |
| 79 | if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT) |
| 80 | { |
| 81 | segment_name = format (0, "memfd-%ld%c", segment_handle, 0); |
| 82 | rv = vcl_segment_attach (segment_handle, (char *) segment_name, |
| 83 | SSVM_SEGMENT_MEMFD, fds[n_fds_used++]); |
| 84 | vec_free (segment_name); |
| 85 | if (rv != 0) |
| 86 | goto failed; |
| 87 | } |
| 88 | |
Florin Coras | b462418 | 2020-12-11 13:58:12 -0800 | [diff] [blame] | 89 | vcl_segment_attach_mq (segment_handle, mp->app_mq, 0, &wrk->app_event_queue); |
| 90 | |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 91 | if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD) |
| 92 | { |
Florin Coras | 86f1232 | 2021-01-22 15:05:14 -0800 | [diff] [blame] | 93 | svm_msg_q_set_eventfd (wrk->app_event_queue, fds[n_fds_used++]); |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 94 | vcl_mq_epoll_add_evfd (wrk, wrk->app_event_queue); |
| 95 | } |
| 96 | |
Florin Coras | 80b7425 | 2021-01-27 18:08:25 -0800 | [diff] [blame] | 97 | vcl_segment_discover_mqs (vcl_vpp_worker_segment_handle (0), |
| 98 | fds + n_fds_used, mp->n_fds - n_fds_used); |
| 99 | vcl_segment_attach_mq (vcl_vpp_worker_segment_handle (0), mp->vpp_ctrl_mq, |
| 100 | mp->vpp_ctrl_mq_thread, &wrk->ctrl_mq); |
| 101 | vcm->ctrl_mq = wrk->ctrl_mq; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 102 | vcm->app_index = mp->app_index; |
| 103 | |
| 104 | return 0; |
| 105 | |
| 106 | failed: |
| 107 | |
| 108 | for (i = clib_max (n_fds_used - 1, 0); i < mp->n_fds; i++) |
| 109 | close (fds[i]); |
| 110 | |
| 111 | return -1; |
| 112 | } |
| 113 | |
| 114 | static int |
| 115 | vcl_api_send_attach (clib_socket_t * cs) |
| 116 | { |
| 117 | app_sapi_msg_t msg = { 0 }; |
| 118 | app_sapi_attach_msg_t *mp = &msg.attach; |
| 119 | u8 app_is_proxy, tls_engine; |
| 120 | clib_error_t *err; |
| 121 | |
| 122 | app_is_proxy = (vcm->cfg.app_proxy_transport_tcp || |
| 123 | vcm->cfg.app_proxy_transport_udp); |
| 124 | tls_engine = CRYPTO_ENGINE_OPENSSL; |
| 125 | |
| 126 | clib_memcpy (&mp->name, vcm->app_name, vec_len (vcm->app_name)); |
| 127 | mp->options[APP_OPTIONS_FLAGS] = |
| 128 | APP_OPTIONS_FLAGS_ACCEPT_REDIRECT | APP_OPTIONS_FLAGS_ADD_SEGMENT | |
| 129 | (vcm->cfg.app_scope_local ? APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE : 0) | |
| 130 | (vcm->cfg.app_scope_global ? APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE : 0) | |
| 131 | (app_is_proxy ? APP_OPTIONS_FLAGS_IS_PROXY : 0) | |
Junfeng Wang | c795b88 | 2022-08-12 16:24:46 +0800 | [diff] [blame] | 132 | (vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0) | |
| 133 | (vcm->cfg.huge_page ? APP_OPTIONS_FLAGS_USE_HUGE_PAGE : 0); |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 134 | mp->options[APP_OPTIONS_PROXY_TRANSPORT] = |
| 135 | (u64) ((vcm->cfg.app_proxy_transport_tcp ? 1 << TRANSPORT_PROTO_TCP : 0) | |
| 136 | (vcm->cfg.app_proxy_transport_udp ? 1 << TRANSPORT_PROTO_UDP : 0)); |
| 137 | mp->options[APP_OPTIONS_SEGMENT_SIZE] = vcm->cfg.segment_size; |
| 138 | mp->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = vcm->cfg.add_segment_size; |
| 139 | mp->options[APP_OPTIONS_RX_FIFO_SIZE] = vcm->cfg.rx_fifo_size; |
| 140 | mp->options[APP_OPTIONS_TX_FIFO_SIZE] = vcm->cfg.tx_fifo_size; |
| 141 | mp->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = |
| 142 | vcm->cfg.preallocated_fifo_pairs; |
| 143 | mp->options[APP_OPTIONS_EVT_QUEUE_SIZE] = vcm->cfg.event_queue_size; |
| 144 | mp->options[APP_OPTIONS_TLS_ENGINE] = tls_engine; |
| 145 | |
| 146 | msg.type = APP_SAPI_MSG_TYPE_ATTACH; |
| 147 | err = clib_socket_sendmsg (cs, &msg, sizeof (msg), 0, 0); |
| 148 | if (err) |
| 149 | { |
| 150 | clib_error_report (err); |
| 151 | return -1; |
| 152 | } |
| 153 | |
| 154 | return 0; |
| 155 | } |
| 156 | |
| 157 | int |
| 158 | vcl_sapi_attach (void) |
| 159 | { |
| 160 | vcl_worker_t *wrk = vcl_worker_get_current (); |
| 161 | app_sapi_msg_t _rmp, *rmp = &_rmp; |
| 162 | clib_error_t *err; |
| 163 | clib_socket_t *cs; |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 164 | int fds[32]; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 165 | |
| 166 | /* |
| 167 | * Init client socket and send attach |
| 168 | */ |
| 169 | if (vcl_api_connect_app_socket (wrk)) |
| 170 | return -1; |
| 171 | |
| 172 | cs = &wrk->app_api_sock; |
| 173 | if (vcl_api_send_attach (cs)) |
| 174 | return -1; |
| 175 | |
| 176 | /* |
| 177 | * Wait for attach reply |
| 178 | */ |
| 179 | err = clib_socket_recvmsg (cs, rmp, sizeof (*rmp), fds, ARRAY_LEN (fds)); |
| 180 | if (err) |
| 181 | { |
| 182 | clib_error_report (err); |
| 183 | return -1; |
| 184 | } |
| 185 | |
| 186 | if (rmp->type != APP_SAPI_MSG_TYPE_ATTACH_REPLY) |
| 187 | return -1; |
| 188 | |
| 189 | return vcl_api_attach_reply_handler (&rmp->attach_reply, fds); |
| 190 | } |
| 191 | |
| 192 | static int |
| 193 | vcl_api_add_del_worker_reply_handler (app_sapi_worker_add_del_reply_msg_t * |
| 194 | mp, int *fds) |
| 195 | { |
| 196 | int n_fds = 0, i, rv; |
| 197 | u64 segment_handle; |
| 198 | vcl_worker_t *wrk; |
| 199 | |
| 200 | if (mp->retval) |
| 201 | { |
| 202 | VDBG (0, "add/del worker failed: %U", format_session_error, mp->retval); |
| 203 | goto failed; |
| 204 | } |
| 205 | |
| 206 | if (!mp->is_add) |
| 207 | goto failed; |
| 208 | |
| 209 | wrk = vcl_worker_get_current (); |
Florin Coras | cc7c88e | 2020-09-15 15:56:51 -0700 | [diff] [blame] | 210 | wrk->api_client_handle = mp->api_client_handle; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 211 | wrk->vpp_wrk_index = mp->wrk_index; |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 212 | wrk->ctrl_mq = vcm->ctrl_mq; |
| 213 | |
| 214 | segment_handle = mp->segment_handle; |
| 215 | if (segment_handle == VCL_INVALID_SEGMENT_HANDLE) |
| 216 | { |
| 217 | clib_warning ("invalid segment handle"); |
| 218 | goto failed; |
| 219 | } |
| 220 | |
| 221 | if (!mp->n_fds) |
| 222 | goto failed; |
| 223 | |
| 224 | if (mp->fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT) |
| 225 | if (vcl_segment_attach (vcl_vpp_worker_segment_handle (wrk->wrk_index), |
| 226 | "vpp-worker-seg", SSVM_SEGMENT_MEMFD, |
| 227 | fds[n_fds++])) |
| 228 | goto failed; |
| 229 | |
| 230 | if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT) |
| 231 | { |
| 232 | u8 *segment_name = format (0, "memfd-%ld%c", segment_handle, 0); |
| 233 | rv = vcl_segment_attach (segment_handle, (char *) segment_name, |
| 234 | SSVM_SEGMENT_MEMFD, fds[n_fds++]); |
| 235 | vec_free (segment_name); |
| 236 | if (rv != 0) |
| 237 | goto failed; |
| 238 | } |
| 239 | |
Florin Coras | b462418 | 2020-12-11 13:58:12 -0800 | [diff] [blame] | 240 | vcl_segment_attach_mq (segment_handle, mp->app_event_queue_address, 0, |
| 241 | &wrk->app_event_queue); |
| 242 | |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 243 | if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD) |
| 244 | { |
Florin Coras | 86f1232 | 2021-01-22 15:05:14 -0800 | [diff] [blame] | 245 | svm_msg_q_set_eventfd (wrk->app_event_queue, fds[n_fds]); |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 246 | vcl_mq_epoll_add_evfd (wrk, wrk->app_event_queue); |
| 247 | n_fds++; |
| 248 | } |
| 249 | |
| 250 | VDBG (0, "worker %u vpp-worker %u added", wrk->wrk_index, |
| 251 | wrk->vpp_wrk_index); |
| 252 | |
| 253 | return 0; |
| 254 | |
| 255 | failed: |
| 256 | for (i = clib_max (n_fds - 1, 0); i < mp->n_fds; i++) |
| 257 | close (fds[i]); |
| 258 | |
| 259 | return -1; |
| 260 | } |
| 261 | |
| 262 | int |
| 263 | vcl_sapi_app_worker_add (void) |
| 264 | { |
| 265 | vcl_worker_t *wrk = vcl_worker_get_current (); |
| 266 | app_sapi_worker_add_del_msg_t *mp; |
| 267 | app_sapi_msg_t _rmp, *rmp = &_rmp; |
| 268 | app_sapi_msg_t msg = { 0 }; |
| 269 | int fds[SESSION_N_FD_TYPE]; |
| 270 | clib_error_t *err; |
| 271 | clib_socket_t *cs; |
| 272 | |
| 273 | /* Connect to socket api */ |
| 274 | if (vcl_api_connect_app_socket (wrk)) |
| 275 | return -1; |
| 276 | |
| 277 | /* |
| 278 | * Send add worker |
| 279 | */ |
| 280 | cs = &wrk->app_api_sock; |
| 281 | |
| 282 | msg.type = APP_SAPI_MSG_TYPE_ADD_DEL_WORKER; |
| 283 | mp = &msg.worker_add_del; |
| 284 | mp->app_index = vcm->app_index; |
| 285 | mp->is_add = 1; |
| 286 | |
| 287 | err = clib_socket_sendmsg (cs, &msg, sizeof (msg), 0, 0); |
| 288 | if (err) |
| 289 | { |
| 290 | clib_error_report (err); |
| 291 | return -1; |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | * Wait for reply and process it |
| 296 | */ |
| 297 | err = clib_socket_recvmsg (cs, rmp, sizeof (*rmp), fds, ARRAY_LEN (fds)); |
| 298 | if (err) |
| 299 | { |
| 300 | clib_error_report (err); |
| 301 | return -1; |
| 302 | } |
| 303 | |
| 304 | if (rmp->type != APP_SAPI_MSG_TYPE_ADD_DEL_WORKER_REPLY) |
| 305 | { |
| 306 | clib_warning ("unexpected reply type %u", rmp->type); |
| 307 | return -1; |
| 308 | } |
| 309 | |
| 310 | return vcl_api_add_del_worker_reply_handler (&rmp->worker_add_del_reply, |
| 311 | fds); |
| 312 | } |
| 313 | |
| 314 | void |
| 315 | vcl_sapi_app_worker_del (vcl_worker_t * wrk) |
| 316 | { |
| 317 | app_sapi_worker_add_del_msg_t *mp; |
| 318 | app_sapi_msg_t msg = { 0 }; |
| 319 | clib_error_t *err; |
| 320 | clib_socket_t *cs; |
| 321 | |
| 322 | cs = &wrk->app_api_sock; |
| 323 | |
| 324 | msg.type = APP_SAPI_MSG_TYPE_ADD_DEL_WORKER; |
| 325 | mp = &msg.worker_add_del; |
| 326 | mp->app_index = vcm->app_index; |
| 327 | mp->wrk_index = wrk->vpp_wrk_index; |
| 328 | mp->is_add = 0; |
| 329 | |
| 330 | err = clib_socket_sendmsg (cs, &msg, sizeof (msg), 0, 0); |
| 331 | if (err) |
| 332 | clib_error_report (err); |
| 333 | clib_socket_close (cs); |
| 334 | } |
| 335 | |
| 336 | void |
| 337 | vcl_sapi_detach (vcl_worker_t * wrk) |
| 338 | { |
| 339 | clib_socket_t *cs = &wrk->app_api_sock; |
| 340 | clib_socket_close (cs); |
| 341 | } |
| 342 | |
| 343 | int |
| 344 | vcl_sapi_recv_fds (vcl_worker_t * wrk, int *fds, int n_fds) |
| 345 | { |
| 346 | app_sapi_msg_t _msg, *msg = &_msg; |
| 347 | clib_socket_t *cs; |
| 348 | clib_error_t *err; |
| 349 | |
| 350 | cs = &wrk->app_api_sock; |
| 351 | |
| 352 | err = clib_socket_recvmsg (cs, msg, sizeof (*msg), fds, n_fds); |
| 353 | if (err) |
| 354 | { |
| 355 | clib_error_report (err); |
| 356 | return -1; |
| 357 | } |
| 358 | if (msg->type != APP_SAPI_MSG_TYPE_SEND_FDS) |
| 359 | return -1; |
| 360 | |
| 361 | return 0; |
| 362 | } |
| 363 | |
Florin Coras | e191d76 | 2021-08-11 14:55:49 -0700 | [diff] [blame] | 364 | int |
| 365 | vcl_sapi_add_cert_key_pair (vppcom_cert_key_pair_t *ckpair) |
| 366 | { |
| 367 | u32 cert_len = ckpair->cert_len, key_len = ckpair->key_len, certkey_len; |
| 368 | vcl_worker_t *wrk = vcl_worker_get_current (); |
| 369 | app_sapi_msg_t _msg = { 0 }, *msg = &_msg; |
| 370 | app_sapi_cert_key_add_del_msg_t *mp; |
| 371 | app_sapi_msg_t _rmp, *rmp = &_rmp; |
| 372 | clib_error_t *err; |
| 373 | clib_socket_t *cs; |
| 374 | u8 *certkey = 0; |
| 375 | int rv = -1; |
| 376 | |
| 377 | msg->type = APP_SAPI_MSG_TYPE_ADD_DEL_CERT_KEY; |
| 378 | mp = &msg->cert_key_add_del; |
| 379 | mp->context = wrk->wrk_index; |
| 380 | mp->cert_len = cert_len; |
| 381 | mp->certkey_len = cert_len + key_len; |
| 382 | mp->is_add = 1; |
| 383 | |
| 384 | certkey_len = cert_len + key_len; |
| 385 | vec_validate (certkey, certkey_len - 1); |
| 386 | clib_memcpy_fast (certkey, ckpair->cert, cert_len); |
| 387 | clib_memcpy_fast (certkey + cert_len, ckpair->key, key_len); |
| 388 | |
| 389 | cs = &wrk->app_api_sock; |
| 390 | err = clib_socket_sendmsg (cs, msg, sizeof (*msg), 0, 0); |
| 391 | if (err) |
| 392 | { |
| 393 | clib_error_report (err); |
| 394 | goto done; |
| 395 | } |
| 396 | |
| 397 | err = clib_socket_sendmsg (cs, certkey, certkey_len, 0, 0); |
| 398 | if (err) |
| 399 | { |
| 400 | clib_error_report (err); |
| 401 | goto done; |
| 402 | } |
| 403 | |
| 404 | /* |
| 405 | * Wait for reply and process it |
| 406 | */ |
| 407 | err = clib_socket_recvmsg (cs, rmp, sizeof (*rmp), 0, 0); |
| 408 | if (err) |
| 409 | { |
| 410 | clib_error_report (err); |
| 411 | goto done; |
| 412 | } |
| 413 | |
| 414 | if (rmp->type != APP_SAPI_MSG_TYPE_ADD_DEL_CERT_KEY_REPLY) |
| 415 | { |
| 416 | clib_warning ("unexpected reply type %u", rmp->type); |
| 417 | goto done; |
| 418 | } |
| 419 | |
| 420 | if (!rmp->cert_key_add_del_reply.retval) |
| 421 | rv = rmp->cert_key_add_del_reply.index; |
| 422 | |
| 423 | done: |
| 424 | |
| 425 | return rv; |
| 426 | } |
| 427 | |
| 428 | int |
| 429 | vcl_sapi_del_cert_key_pair (u32 ckpair_index) |
| 430 | { |
| 431 | vcl_worker_t *wrk = vcl_worker_get_current (); |
| 432 | app_sapi_msg_t _msg = { 0 }, *msg = &_msg; |
| 433 | app_sapi_cert_key_add_del_msg_t *mp; |
| 434 | app_sapi_msg_t _rmp, *rmp = &_rmp; |
| 435 | clib_error_t *err; |
| 436 | clib_socket_t *cs; |
| 437 | |
| 438 | msg->type = APP_SAPI_MSG_TYPE_ADD_DEL_CERT_KEY; |
| 439 | mp = &msg->cert_key_add_del; |
| 440 | mp->context = wrk->wrk_index; |
| 441 | mp->index = ckpair_index; |
| 442 | |
| 443 | cs = &wrk->app_api_sock; |
Filip Tehlar | eeb31ec | 2022-03-17 17:25:47 +0000 | [diff] [blame] | 444 | err = clib_socket_sendmsg (cs, msg, sizeof (*msg), 0, 0); |
Florin Coras | e191d76 | 2021-08-11 14:55:49 -0700 | [diff] [blame] | 445 | if (err) |
| 446 | { |
| 447 | clib_error_report (err); |
| 448 | return -1; |
| 449 | } |
| 450 | |
| 451 | /* |
| 452 | * Wait for reply and process it |
| 453 | */ |
| 454 | err = clib_socket_recvmsg (cs, rmp, sizeof (*rmp), 0, 0); |
| 455 | if (err) |
| 456 | { |
| 457 | clib_error_report (err); |
| 458 | return -1; |
| 459 | } |
| 460 | |
| 461 | if (rmp->type != APP_SAPI_MSG_TYPE_ADD_DEL_CERT_KEY_REPLY) |
| 462 | { |
| 463 | clib_warning ("unexpected reply type %u", rmp->type); |
| 464 | return -1; |
| 465 | } |
| 466 | |
| 467 | if (rmp->cert_key_add_del_reply.retval) |
| 468 | return -1; |
| 469 | |
| 470 | return 0; |
| 471 | } |
| 472 | |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 473 | /* |
| 474 | * fd.io coding-style-patch-verification: ON |
| 475 | * |
| 476 | * Local Variables: |
| 477 | * eval: (c-set-style "gnu") |
| 478 | * End: |
| 479 | */ |