summaryrefslogtreecommitdiffstats
path: root/src/vnet/replication.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-14vlib: internal buffer manager reworkDamjan Marion1-3/+2
- buffer_main is no longer part of vlib_main_t - pool of free lists is still part of vlib_main_t - mheap is not used anymore for buffer allocation - simple bitmap bassed buffer alloc scheme is introduced Change-Id: I3e1e6d00e2c8122293ed0a741245eb841315a1ff Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-01-31vlib: allocating buffers on thread-x and freeing them on thread-y causesSteven1-2/+1
a crash on debug image (VPP-1151) In debug image, there is extra code to validate the buffer when it is freed. It uses the hash table to lookup the buffer index with spinlock to prevent contention. However, there is one spinlock for each worker thread. So allocating the buffer on thread-x and freeing the same buffer on thread-y causes the validation to fail on thread-y. The fix is to have only one spinlock, stored in vlib_global_main. Change-Id: Ic383846cefe84a3e262255afcf82276742f0f62e Signed-off-by: Steven <sluong@cisco.com> (cherry picked from commit a7effa1b072463f12305a474f082aeaffb7ada4b)
2017-11-14l2-flood: fix restore vnet buffer's flags in the replication routineSteve Shin1-0/+5
When BUM packets are flooded in the l2 domain, some data should be kept and restored for recycling in the replication routine. If l2 bridge domain has multiple interfaces mixed with normal and vlan tagged, the vlan tag value of the vnet buffer can be changed while flooding the replicated packets. The change is made to store and restore the original vlan tag in the replication logic. Change-Id: I399cf54cd2e74cb44a2be42241bdc4fba85032c5 Signed-off-by: Steve Shin <jonshin@cisco.com>
2017-07-14Introduce l{2,3,4}_hdr_offset fields in the buffer metadataDamjan Marion1-3/+3
To save space in the first cacheline following is changed: - total_length_not_including_first_buffer moved to the 2nd cacheline. This field is used only when VLIB_BUFFER_TOTAL_LENGTH_VALID and VLIB_BUFFER_NEXT_PRESENT are both set. - free_list_index is now stored in 4bits inside flags, which allows up to 16 free lists. In case we need more we can store index in the 2nd cachelin Change-Id: Ic8521350819391af470d31d3fa1013e67ecb7681 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-10vlib: store buffer memory information in the buffer_mainDamjan Marion1-1/+1
Currently, buffer index is calculated as a offset to the physmem region shifted by log2_cacheline size. When DPDK is used we "hack" physmem data with information taken from dpdk mempool. This makes physmem code not usable with DPDK. This change makes buffer memory start and size independent of physmem basically allowing physmem to be used when DPDK plugin is loaded. Change-Id: Ieb399d398f147583b9baab467152a352d58c9c31 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-04-06Use thread local storage for thread indexDamjan Marion1-10/+10
This patch deprecates stack-based thread identification, Also removes requirement that thread stacks are adjacent. Finally, possibly annoying for some folks, it renames all occurences of cpu_index and cpu_number with thread index. Using word "cpu" is misleading here as thread can be migrated ti different CPU, and also it is not related to linux cpu index. Change-Id: I68cdaf661e701d2336fc953dcb9978d10a70f7c1 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-01dpdk: be a pluginDamjan Marion1-3/+3
Change-Id: I238258cdeb77035adc5e88903d824593d0a1da90 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-02-06vlib: remove algned/unaligned buffers schemeDamjan Marion1-18/+5
Change-Id: I4433eaed3f4e201edc329c4842cbbf74beb19a9a Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+293
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>
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 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
/*
 * Copyright (c) 2020 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @file
 * @brief DET44 CLI
 */
#include <nat/det44/det44.h>

static clib_error_t *
det44_map_command_fn (vlib_main_t * vm, unformat_input_t * input,
		      vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  ip4_address_t in_addr, out_addr;
  u32 in_plen, out_plen;
  int is_add = 1, rv;
  clib_error_t *error = 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, "in %U/%u", unformat_ip4_address, &in_addr, &in_plen))
	;
      else
	if (unformat
	    (line_input, "out %U/%u", unformat_ip4_address, &out_addr,
	     &out_plen))
	;
      else if (unformat (line_input, "del"))
	is_add = 0;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  rv = snat_det_add_map (&in_addr, (u8) in_plen, &out_addr, (u8) out_plen,
			 is_add);

  if (rv)
    {
      error = clib_error_return (0, "snat_det_add_map return %d", rv);
      goto done;
    }

done:
  unformat_free (line_input);

  return error;
}

static clib_error_t *
det44_show_mappings_command_fn (vlib_main_t * vm,
				unformat_input_t * input,
				vlib_cli_command_t * cmd)
{
  det44_main_t *dm = &det44_main;
  snat_det_map_t *mp;
  vlib_cli_output (vm, "NAT44 deterministic mappings:");
  /* *INDENT-OFF* */
  pool_foreach (mp, dm->det_maps)
   {
    vlib_cli_output (vm, " in %U/%d out %U/%d\n",
                     format_ip4_address, &mp->in_addr, mp->in_plen,
                     format_ip4_address, &mp->out_addr, mp->out_plen);
    vlib_cli_output (vm, "  outside address sharing ratio: %d\n",
                     mp->sharing_ratio);
    vlib_cli_output (vm, "  number of ports per inside host: %d\n",
                     mp->ports_per_host);
    vlib_cli_output (vm, "  sessions number: %d\n", mp->ses_num);
  }
  /* *INDENT-ON* */
  return 0;
}

static clib_error_t *
det44_forward_command_fn (vlib_main_t * vm,
			  unformat_input_t * input, vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  ip4_address_t in_addr, out_addr;
  u16 lo_port;
  snat_det_map_t *mp;
  clib_error_t *error = 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, "%U", unformat_ip4_address, &in_addr))
	;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  mp = snat_det_map_by_user (&in_addr);
  if (!mp)
    vlib_cli_output (vm, "no match");
  else
    {
      snat_det_forward (mp, &in_addr, &out_addr, &lo_port);
      vlib_cli_output (vm, "%U:<%d-%d>", format_ip4_address, &out_addr,
		       lo_port, lo_port + mp->ports_per_host - 1);
    }

done:
  unformat_free (line_input);

  return error;
}

static clib_error_t *
det44_reverse_command_fn (vlib_main_t * vm,
			  unformat_input_t * input, vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  ip4_address_t in_addr, out_addr;
  clib_error_t *error = 0;
  snat_det_map_t *mp;
  u32 out_port;

  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, "%U:%d", unformat_ip4_address, &out_addr, &out_port))
	;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  if (out_port < 1024 || out_port > 65535)
    {
      error = clib_error_return (0, "wrong port, must be <1024-65535>");
      goto done;
    }

  mp = snat_det_map_by_out (&out_addr);
  if (!mp)
    vlib_cli_output (vm, "no match");
  else
    {
      snat_det_reverse (mp, &out_addr, (u16) out_port, &in_addr);
      vlib_cli_output (vm, "%U", format_ip4_address, &in_addr);
    }

done:
  unformat_free (line_input);

  return error;
}

static clib_error_t *
det44_show_sessions_command_fn (vlib_main_t * vm,
				unformat_input_t * input,
				vlib_cli_command_t * cmd)
{
  det44_main_t *dm = &det44_main;
  snat_det_session_t *ses;
  snat_det_map_t *mp;
  vlib_cli_output (vm, "NAT44 deterministic sessions:");
  /* *INDENT-OFF* */
  pool_foreach (mp, dm->det_maps)
   {
    int i;
    vec_foreach_index (i, mp->sessions)
      {
        ses = vec_elt_at_index (mp->sessions, i);
        if (ses->in_port)
          vlib_cli_output (vm, "  %U", format_det_map_ses, mp, ses, &i);
      }
  }
  /* *INDENT-ON* */
  return 0;
}

static clib_error_t *
det44_close_session_out_fn (vlib_main_t * vm,
			    unformat_input_t * input,
			    vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  ip4_address_t out_addr, ext_addr, in_addr;
  u32 out_port, ext_port;
  snat_det_map_t *mp;
  snat_det_session_t *ses;
  snat_det_out_key_t key;
  clib_error_t *error = 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, "%U:%d %U:%d",
		    unformat_ip4_address, &out_addr, &out_port,
		    unformat_ip4_address, &ext_addr, &ext_port))
	;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  unformat_free (line_input);

  mp = snat_det_map_by_out (&out_addr);
  if (!mp)
    vlib_cli_output (vm, "no match");
  else
    {
      snat_det_reverse (mp, &ext_addr, (u16) out_port, &in_addr);
      key.ext_host_addr = out_addr;
      key.ext_host_port = ntohs ((u16) ext_port);
      key.out_port = ntohs ((u16) out_port);
      ses = snat_det_get_ses_by_out (mp, &out_addr, key.as_u64);
      if (!ses)
	vlib_cli_output (vm, "no match");
      else
	snat_det_ses_close (mp, ses);
    }

done:
  unformat_free (line_input);

  return error;
}

static clib_error_t *
det44_close_session_in_fn (vlib_main_t * vm,
			   unformat_input_t * input, vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  ip4_address_t in_addr, ext_addr;
  u32 in_port, ext_port;
  snat_det_map_t *mp;
  snat_det_session_t *ses;
  snat_det_out_key_t key;
  clib_error_t *error = 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, "%U:%d %U:%d",
		    unformat_ip4_address, &in_addr, &in_port,
		    unformat_ip4_address, &ext_addr, &ext_port))
	;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  unformat_free (line_input);

  mp = snat_det_map_by_user (&in_addr);
  if (!mp)
    vlib_cli_output (vm, "no match");
  else
    {
      key.ext_host_addr = ext_addr;
      key.ext_host_port = ntohs ((u16) ext_port);
      ses =
	snat_det_find_ses_by_in (mp, &in_addr, ntohs ((u16) in_port), key);
      if (!ses)
	vlib_cli_output (vm, "no match");
      else
	snat_det_ses_close (mp, ses);
    }

done:
  unformat_free (line_input);

  return error;
}

static clib_error_t *
det44_set_timeouts_command_fn (vlib_main_t * vm,
			       unformat_input_t * input,
			       vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  nat_timeouts_t timeouts = { 0 };
  clib_error_t *error = 0;
  u8 reset = 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, "udp %u", &timeouts.udp));
      else if (unformat (line_input, "tcp established %u",
			 &timeouts.tcp.established));
      else if (unformat (line_input, "tcp transitory %u",
			 &timeouts.tcp.transitory));
      else if (unformat (line_input, "icmp %u", &timeouts.icmp));
      else if (unformat (line_input, "reset"))
	reset = 1;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  if (!reset)
    {
      if (det44_set_timeouts (&timeouts))
	{
	  error = clib_error_return (0, "error configuring timeouts");
	}
    }
  else
    det44_reset_timeouts ();
done:
  unformat_free (line_input);
  return error;
}

static clib_error_t *
det44_show_timeouts_command_fn (vlib_main_t * vm,
				unformat_input_t * input,
				vlib_cli_command_t * cmd)
{
  nat_timeouts_t timeouts;
  timeouts = det44_get_timeouts ();
  vlib_cli_output (vm, "udp timeout: %dsec", timeouts.udp);
  vlib_cli_output (vm, "tcp established timeout: %dsec",
		   timeouts.tcp.established);
  vlib_cli_output (vm, "tcp transitory timeout: %dsec",
		   timeouts.tcp.transitory);
  vlib_cli_output (vm, "icmp timeout: %dsec", timeouts.icmp);
  return 0;
}

static clib_error_t *
det44_plugin_enable_disable_command_fn (vlib_main_t * vm,
					unformat_input_t * input,
					vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  u8 enable = 0, is_set = 0;
  clib_error_t *error = 0;
  det44_config_t c = { 0 };

  if (!unformat_user (input, unformat_line_input, line_input))
    return 0;

  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
    {
      if (!is_set && unformat (line_input, "enable"))
	{
	  unformat (line_input, "inside vrf %u", &c.inside_vrf_id);
	  unformat (line_input, "outside vrf %u", &c.outside_vrf_id);
	  enable = 1;
	}
      else if (!is_set && unformat (line_input, "disable"));
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
      is_set = 1;
    }

  if (enable)
    {
      if (det44_plugin_enable (c))
	error = clib_error_return (0, "plugin enable failed");
    }
  else
    {
      if (det44_plugin_disable ())
	error = clib_error_return (0, "plugin disable failed");
    }
done:
  unformat_free (line_input);
  return error;
}

typedef struct
{
  u32 sw_if_index;
  u8 is_inside;
} sw_if_indices_t;

static clib_error_t *
det44_feature_command_fn (vlib_main_t * vm,
			  unformat_input_t * input, vlib_cli_command_t * cmd)
{
  unformat_input_t _line_input, *line_input = &_line_input;
  sw_if_indices_t *sw_if_indices = 0, *p, e;
  vnet_main_t *vnm = vnet_get_main ();
  clib_error_t *error = 0;
  u8 is_del = 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, "inside %U", unformat_vnet_sw_interface,
		    vnm, &e.sw_if_index))
	{
	  e.is_inside = 1;
	  vec_add1 (sw_if_indices, e);
	}
      else if (unformat (line_input, "outside %U", unformat_vnet_sw_interface,
			 vnm, &e.sw_if_index))
	{
	  e.is_inside = 0;
	  vec_add1 (sw_if_indices, e);
	}
      else if (unformat (line_input, "del"))
	is_del = 1;
      else
	{
	  error = clib_error_return (0, "unknown input '%U'",
				     format_unformat_error, line_input);
	  goto done;
	}
    }

  /* *INDENT-OFF* */
  vec_foreach (p, sw_if_indices)
    {
      if (det44_interface_add_del (p->sw_if_index, p->is_inside, is_del))
        {
          error = clib_error_return (0, "%s %s %U failed",
                                     is_del ? "del" : "add",
                                     p->is_inside ? "inside" : "outside",
				     format_vnet_sw_if_index_name,
				     vnm, p->sw_if_index);
          break;
        }
    }
  /* *INDENT-ON* */
done:
  unformat_free (line_input);
  vec_free (sw_if_indices);
  return error;
}

static clib_error_t *
det44_show_interfaces_command_fn (vlib_main_t * vm, unformat_input_t * input,
				  vlib_cli_command_t * cmd)
{
  vnet_main_t *vnm = vnet_get_main ();
  det44_main_t *dm = &det44_main;
  det44_interface_t *i;
  vlib_cli_output (vm, "DET44 interfaces:");
  /* *INDENT-OFF* */
  pool_foreach (i, dm->interfaces)
   {
    vlib_cli_output (vm, " %U %s", format_vnet_sw_if_index_name, vnm,
                     i->sw_if_index,
                     (det44_interface_is_inside(i) &&
                      det44_interface_is_outside(i)) ? "in out" :
                     (det44_interface_is_inside(i) ? "in" : "out"));
  }
  /* *INDENT-ON* */
  return 0;
}

/* *INDENT-OFF* */
/*?
 * @cliexpar
 * @cliexstart{det44 add}
 * Create bijective mapping of inside address to outside address and port range
 * pairs, with the purpose of enabling DET44 to reduce logging in CGN
 * deployments.
 * To create mapping between inside network 10.0.0.0/18 and
 * outside network 1.1.1.0/30 use:
 * # vpp# det44 add in 10.0.0.0/18 out 1.1.1.0/30
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_map_command, static) = {
    .path = "det44 add",
    .short_help = "det44 add in <addr>/<plen> out <addr>/<plen> [del]",
    .function = det44_map_command_fn,
};

/*?
 * @cliexpar
 * @cliexpstart{show det44 mappings}
 * Show DET44 mappings
 * vpp# show det44 mappings
 * DET44 mappings:
 *  in 10.0.0.0/24 out 1.1.1.1/32
 *   outside address sharing ratio: 256
 *   number of ports per inside host: 252
 *   sessions number: 0
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_show_mappings_command, static) = {
    .path = "show det44 mappings",
    .short_help = "show det44 mappings",
    .function = det44_show_mappings_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{det44 forward}
 * Return outside address and port range from inside address for DET44.
 * To obtain outside address and port of inside host use:
 *  vpp# det44 forward 10.0.0.2
 *  1.1.1.0:<1054-1068>
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_forward_command, static) = {
    .path = "det44 forward",
    .short_help = "det44 forward <addr>",
    .function = det44_forward_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{det44 reverse}
 * Return inside address from outside address and port for DET44.
 * To obtain inside host address from outside address and port use:
 *  #vpp det44 reverse 1.1.1.1:1276
 *  10.0.16.16
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_reverse_command, static) = {
    .path = "det44 reverse",
    .short_help = "det44 reverse <addr>:<port>",
    .function = det44_reverse_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{show det44 sessions}
 * Show DET44 sessions.
 * vpp# show det44 sessions
 * DET44 sessions:
 *   in 10.0.0.3:3005 out 1.1.1.2:1146 external host 172.16.1.2:3006 state: udp-active expire: 306
 *   in 10.0.0.3:3000 out 1.1.1.2:1141 external host 172.16.1.2:3001 state: udp-active expire: 306
 *   in 10.0.0.4:3005 out 1.1.1.2:1177 external host 172.16.1.2:3006 state: udp-active expire: 306
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_show_sessions_command, static) = {
  .path = "show det44 sessions",
  .short_help = "show det44 sessions",
  .function = det44_show_sessions_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{det44 close session out}
 * Close session using outside ip address and port
 * and external ip address and port, use:
 *  vpp# det44 close session out 1.1.1.1:1276 2.2.2.2:2387
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_close_sesion_out_command, static) = {
  .path = "det44 close session out",
  .short_help = "det44 close session out "
                "<out_addr>:<out_port> <ext_addr>:<ext_port>",
  .function = det44_close_session_out_fn,
};

/*?
 * @cliexpar
 * @cliexstart{det44 deterministic close session in}
 * Close session using inside ip address and port
 * and external ip address and port, use:
 *  vpp# det44 close session in 3.3.3.3:3487 2.2.2.2:2387
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_close_session_in_command, static) = {
  .path = "det44 close session in",
  .short_help = "det44 close session in "
                "<in_addr>:<in_port> <ext_addr>:<ext_port>",
  .function = det44_close_session_in_fn,
};

/*?
 * @cliexpar
 * @cliexstart{set det44 timeout}
 * Set values of timeouts for DET44 sessions (in seconds), use:
 *  vpp# set det44 timeouts udp 120 tcp established 7500 tcp transitory 250 icmp 90
 * To reset default values use:
 *  vpp# set det44 timeouts reset
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_set_timeouts_command, static) =
{
  .path = "set det44 timeouts",
  .short_help = "set det44 timeouts <[udp <sec>] [tcp established <sec>] "
                "[tcp transitory <sec>] [icmp <sec>]|reset>",
  .function = det44_set_timeouts_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{show det44 timeouts}
 * Show values of timeouts for DET44 sessions.
 * vpp# show det44 timeouts
 * udp timeout: 300sec
 * tcp-established timeout: 7440sec
 * tcp-transitory timeout: 240sec
 * icmp timeout: 60sec
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_show_timeouts_command, static) =
{
  .path = "show det44 timeouts",
  .short_help = "show det44 timeouts",
  .function = det44_show_timeouts_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{det44 plugin}
 * Enable/disable DET44 plugin.
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_plugin_enable_disable_command, static) =
{
  .path = "det44 plugin",
  .short_help = "det44 plugin <enable [inside vrf] [outside vrf]|disable>",
  .function = det44_plugin_enable_disable_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{set interface det44}
 * Enable/disable DET44 feature on the interface.
 * To enable DET44 feature with local network interface use:
 *  vpp# set interface det44 inside GigabitEthernet0/8/0
 * To enable DET44 feature with external network interface use:
 *  vpp# set interface det44 outside GigabitEthernet0/a/0
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_feature_command, static) =
{
  .path = "set interface det44",
  .short_help = "set interface det44 inside <intfc> outside <intfc> [del]",
  .function = det44_feature_command_fn,
};

/*?
 * @cliexpar
 * @cliexstart{show det44 interfaces}
 * Show interfaces with DET44 feature.
 * vpp# show det44 interfaces
 * DET44 interfaces:
 *  GigabitEthernet0/8/0 in
 *  GigabitEthernet0/a/0 out
 * @cliexend
?*/
VLIB_CLI_COMMAND (det44_show_interfaces_command, static) =
{
  .path = "show det44 interfaces",
  .short_help = "show det44 interfaces",
  .function = det44_show_interfaces_command_fn,
};
/* *INDENT-ON* */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */