118 bd_config->
members[0] = *member;
123 #define BD_REMOVE_ERROR_OK 0 124 #define BD_REMOVE_ERROR_NOT_FOUND 1 170 u32 feature_bitmap = 0;
178 feature_bitmap |= L2INPUT_FEAT_LEARN;
181 feature_bitmap |= L2INPUT_FEAT_FWD;
184 feature_bitmap |= L2INPUT_FEAT_FLOOD;
187 feature_bitmap |= L2INPUT_FEAT_UU_FLOOD;
190 feature_bitmap |= L2INPUT_FEAT_ARP_TERM;
216 if (!
unformat (input,
"%d", &bd_id))
246 .path =
"set bridge-domain learn",
247 .short_help =
"set bridge-domain learn <bridge-domain-id> [disable]",
265 if (!
unformat (input,
"%d", &bd_id))
295 .path =
"set bridge-domain forward",
296 .short_help =
"set bridge-domain forward <bridge-domain-id> [disable]",
314 if (!
unformat (input,
"%d", &bd_id))
344 .path =
"set bridge-domain flood",
345 .short_help =
"set bridge-domain flood <bridge-domain-id> [disable]",
363 if (!
unformat (input,
"%d", &bd_id))
393 .path =
"set bridge-domain uu-flood",
394 .short_help =
"set bridge-domain uu-flood <bridge-domain-id> [disable]",
412 if (!
unformat (input,
"%d", &bd_id)) {
419 if (p) bd_index = *p;
423 if (
unformat (input,
"disable")) enable = 0;
436 .path =
"set bridge-domain arp term",
437 .short_help =
"set bridge-domain arp term <bridge-domain-id> [disable]",
455 u64 new_mac = *(
u64 *) mac_addr;
457 u16 * mac16 = (
u16 *) &new_mac;
469 if (old_mac && (*old_mac == new_mac))
return 0;
472 if (old_mac && (*old_mac == new_mac)) {
499 if (!
unformat (input,
"%d", &bd_id)) {
507 if (p) bd_index = *p;
533 is_add ?
"add" :
"del",
543 .path =
"set bridge-domain arp entry",
544 .short_help =
"set bridge-domain arp entry <bd-id> <ip-addr> <mac-addr> [del]",
550 u32 vtr_op = va_arg (*args,
u32);
551 u32 dot1q = va_arg (*args,
u32);
552 u32 tag1 = va_arg (*args,
u32);
553 u32 tag2 = va_arg (*args,
u32);
556 return format (s,
"none");
558 return format (s,
"push-1 %s %d", dot1q?
"dot1q":
"dot1ad", tag1);
560 return format (s,
"push-2 %s %d %d", dot1q?
"dot1q":
"dot1ad", tag1, tag2);
562 return format (s,
"pop-1");
564 return format (s,
"pop-2");
566 return format (s,
"trans-1-1 %s %d", dot1q?
"dot1q":
"dot1ad", tag1);
568 return format (s,
"trans-1-2 %s %d %d",dot1q?
"dot1q":
"dot1ad", tag1, tag2);
570 return format (s,
"trans-2-1 %s %d", dot1q?
"dot1q":
"dot1ad", tag1);
572 return format (s,
"trans-2-2 %s %d %d", dot1q?
"dot1q":
"dot1ad", tag1, tag2);
574 return format (s,
"none");
602 if (
unformat (input,
"%d", &bd_id)) {
603 if (
unformat (input,
"detail")) detail = 1;
604 else if (
unformat (input,
"det")) detail = 1;
605 if (
unformat (input,
"int")) intf = 1;
606 if (
unformat (input,
"arp")) arp = 1;
609 if (p) bd_index = *p;
626 for (bd_index=start; bd_index<end; bd_index++) {
643 vm,
"%=5d %=7d %=10s %=10s %=10s %=10s %=10s %=14U",
644 bd_config->
bd_id, bd_index,
652 if (detail || intf) {
659 u32 vtr_opr, dot1q, tag1, tag2;
663 "Interface",
"Index",
"SHG",
"BVI",
"VLAN-Tag-Rewrite");
675 if ((detail || arp) &&
681 vlib_cli_output (vm,
"%=20U => %=20U",
682 format_ip4_address, &ip4_addr,
683 format_ethernet_address, &mac_addr);
698 .path =
"show bridge-domain",
699 .short_help =
"show bridge-domain [bridge-domain-id [detail|int|arp]]",
void bd_validate(l2_bridge_domain_t *bd_config)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 bd_set_flags(vlib_main_t *vm, u32 bd_index, u32 flags, u32 enable)
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define hash_set(h, key, value)
#define L2_FLOOD_MEMBER_NORMAL
u8 * format_vnet_sw_if_index_name_with_NA(u8 *s, va_list *args)
#define hash_unset(h, key)
always_inline u32 bd_is_valid(l2_bridge_domain_t *bd_config)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
l2_flood_member_t * members
u32 bd_remove_member(l2_bridge_domain_t *bd_config, u32 sw_if_index)
#define L2_FLOOD_MEMBER_BVI
format_function_t format_vnet_sw_if_index_name
vnet_main_t * vnet_get_main(void)
int bd_delete_bd_index(bd_main_t *bdm, u32 bd_id)
Delete a bridge domain.
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
void bd_add_member(l2_bridge_domain_t *bd_config, l2_flood_member_t *member)
static clib_error_t * bd_fwd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define hash_foreach(key_var, value_var, h, body)
clib_error_t * l2bd_init(vlib_main_t *vm)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
uword * bd_index_by_bd_id
#define BD_REMOVE_ERROR_OK
always_inline uword clib_bitmap_first_clear(uword *ai)
static clib_error_t * bd_arp_entry(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_del1(v, i)
Delete the element at index I.
always_inline uword * clib_bitmap_set(uword *ai, uword i, uword value)
static clib_error_t * bd_flood(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define BD_REMOVE_ERROR_NOT_FOUND
u32 bd_add_del_ip_mac(u32 bd_index, u8 *ip_addr, u8 *mac_addr, u8 is_ip6, u8 is_add)
static clib_error_t * bd_learn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * bd_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define hash_create(elts, value_bytes)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
static clib_error_t * bd_arp_term(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_elt(v, i)
Get vector value at index i.
u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
l2_bridge_domain_t * bd_configs
static clib_error_t * bd_uu_flood(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 * format_vtr(u8 *s, va_list *args)
u32 l2vtr_get(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index, u32 *vtr_op, u32 *push_dot1q, u32 *vtr_tag1, u32 *vtr_tag2)
#define vec_foreach(var, vec)
Vector iterator.
#define clib_error_return(e, args...)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".