summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application_namespace.c11
-rw-r--r--src/vnet/session/application_namespace.h2
-rw-r--r--src/vnet/session/session.api12
-rw-r--r--src/vnet/session/session.c2
-rw-r--r--src/vnet/session/session_api.c11
5 files changed, 33 insertions, 5 deletions
diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c
index bece746a757..cd2636cff32 100644
--- a/src/vnet/session/application_namespace.c
+++ b/src/vnet/session/application_namespace.c
@@ -222,10 +222,15 @@ app_namespace_get_local_table (app_namespace_t * app_ns)
return session_table_get (app_ns->local_table_index);
}
-void
-appns_sapi_enable (void)
+int
+appns_sapi_enable_disable (int is_enable)
{
- app_sapi_enabled = 1;
+ /* This cannot be called with active sockets */
+ if (pool_elts (app_namespace_pool))
+ return -1;
+
+ app_sapi_enabled = is_enable;
+ return 0;
}
u8
diff --git a/src/vnet/session/application_namespace.h b/src/vnet/session/application_namespace.h
index 14e6a650e56..1750d41fff8 100644
--- a/src/vnet/session/application_namespace.h
+++ b/src/vnet/session/application_namespace.h
@@ -162,7 +162,7 @@ appns_sapi_handle_sock_index (u32 sapi_sock_handle)
int appns_sapi_add_ns_socket (app_namespace_t * app_ns);
void appns_sapi_del_ns_socket (app_namespace_t *app_ns);
u8 appns_sapi_enabled (void);
-void appns_sapi_enable (void);
+int appns_sapi_enable_disable (int is_enable);
#endif /* SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_ */
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index 0eb773c0c28..d2a942fb68b 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -203,6 +203,18 @@ autoreply define session_enable_disable {
bool is_enable [default=true];
};
+/** \brief enable/disable session layer socket api
+ @param client_index - opaque cookie to identify the sender
+ client to vpp direction only
+ @param context - sender context, to match reply w/ request
+ @param is_enable - disable session layer if 0, enable otherwise
+*/
+autoreply define session_sapi_enable_disable {
+ u32 client_index;
+ u32 context;
+ bool is_enable [default=true];
+};
+
/** \brief add/del application namespace
@param client_index - opaque cookie to identify the sender
client to vpp direction only
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 05712181ab0..f33dbea9a1e 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -2069,7 +2069,7 @@ session_config_fn (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "segment-baseva 0x%lx", &smm->session_baseva))
;
else if (unformat (input, "use-app-socket-api"))
- appns_sapi_enable ();
+ (void) appns_sapi_enable_disable (1 /* is_enable */);
else if (unformat (input, "poll-main"))
smm->poll_main = 1;
else if (unformat (input, "use-private-rx-mqs"))
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index c031545323e..2121d2075e6 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -602,6 +602,17 @@ vl_api_session_enable_disable_t_handler (vl_api_session_enable_disable_t * mp)
}
static void
+vl_api_session_sapi_enable_disable_t_handler (
+ vl_api_session_sapi_enable_disable_t *mp)
+{
+ vl_api_session_sapi_enable_disable_reply_t *rmp;
+ int rv = 0;
+
+ rv = appns_sapi_enable_disable (mp->is_enable);
+ REPLY_MACRO (VL_API_SESSION_SAPI_ENABLE_DISABLE_REPLY);
+}
+
+static void
vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
{
int rv = 0, *fds = 0, n_fds = 0, n_workers, i;
'n323' href='#n323'>323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514