128 bd_config->
members[0] = *member;
133 #define BD_REMOVE_ERROR_OK 0 134 #define BD_REMOVE_ERROR_NOT_FOUND 1 184 u32 feature_bitmap = 0;
193 feature_bitmap |= L2INPUT_FEAT_LEARN;
197 feature_bitmap |= L2INPUT_FEAT_FWD;
201 feature_bitmap |= L2INPUT_FEAT_FLOOD;
205 feature_bitmap |= L2INPUT_FEAT_UU_FLOOD;
209 feature_bitmap |= L2INPUT_FEAT_ARP_TERM;
239 if (!
unformat (input,
"%d", &bd_id))
273 .path =
"set bridge-domain learn",
274 .short_help =
"set bridge-domain learn <bridge-domain-id> [disable]",
293 if (!
unformat (input,
"%d", &bd_id))
327 .path =
"set bridge-domain forward",
328 .short_help =
"set bridge-domain forward <bridge-domain-id> [disable]",
348 if (!
unformat (input,
"%d", &bd_id))
382 .path =
"set bridge-domain flood",
383 .short_help =
"set bridge-domain flood <bridge-domain-id> [disable]",
403 if (!
unformat (input,
"%d", &bd_id))
437 .path =
"set bridge-domain uu-flood",
438 .short_help =
"set bridge-domain uu-flood <bridge-domain-id> [disable]",
458 if (!
unformat (input,
"%d", &bd_id))
489 .path =
"set bridge-domain arp term",
490 .short_help =
"set bridge-domain arp term <bridge-domain-id> [disable]",
509 u8 * ip_addr,
u8 * mac_addr,
u8 is_ip6,
u8 is_add)
513 u64 new_mac = *(
u64 *) mac_addr;
515 u16 *mac16 = (
u16 *) & new_mac;
532 if (old_mac && (*old_mac == new_mac))
539 if (old_mac && (*old_mac == new_mac))
571 if (!
unformat (input,
"%d", &bd_id))
616 is_add ?
"add" :
"del",
627 .path =
"set bridge-domain arp entry",
628 .short_help =
"set bridge-domain arp entry <bd-id> <ip-addr> <mac-addr> [del]",
636 u32 vtr_op = va_arg (*args,
u32);
637 u32 dot1q = va_arg (*args,
u32);
638 u32 tag1 = va_arg (*args,
u32);
639 u32 tag2 = va_arg (*args,
u32);
643 return format (s,
"none");
645 return format (s,
"push-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
647 return format (s,
"push-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad", tag1,
650 return format (s,
"pop-1");
652 return format (s,
"pop-2");
654 return format (s,
"trans-1-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
656 return format (s,
"trans-1-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
659 return format (s,
"trans-2-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
661 return format (s,
"trans-2-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
664 return format (s,
"none");
725 for (bd_index = start; bd_index < end; bd_index++)
734 "%=5s %=7s %=10s %=10s %=10s %=10s %=10s %=14s",
735 "ID",
"Index",
"Learning",
"U-Forwrd",
736 "UU-Flood",
"Flooding",
"ARP-Term",
741 "%=5d %=7d %=10s %=10s %=10s %=10s %=10s %=14U",
742 bd_config->
bd_id, bd_index,
764 u32 vtr_opr, dot1q, tag1, tag2;
769 "Interface",
"Index",
"SHG",
"BVI",
783 if ((detail || arp) &&
789 "\n IP4 to MAC table for ARP Termination");
794 vlib_cli_output (vm,
"%=20U => %=20U",
795 format_ip4_address, &ip4_addr,
796 format_ethernet_address, &mac_addr);
814 .path =
"show bridge-domain",
815 .short_help =
"show bridge-domain [bridge-domain-id [detail|int|arp]]",
void bd_validate(l2_bridge_domain_t *bd_config)
Init bridge domain if not done already.
#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)
Set the learn/forward/flood flags for the bridge domain.
#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)
Format sw_if_index.
#define hash_unset(h, key)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
l2_flood_member_t * members
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
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)
Set bridge-domain forward enable/disable.
#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
static clib_error_t * bd_arp_entry(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain arp entry add/delete.
#define vec_del1(v, i)
Delete the element at index I.
static clib_error_t * bd_flood(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain flood enable/disable.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static u32 bd_is_valid(l2_bridge_domain_t *bd_config)
#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)
Add/delete IP address to MAC address mapping.
static clib_error_t * bd_learn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain learn enable/disable.
static clib_error_t * bd_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Show bridge-domain state.
#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)
Set bridge-domain arp term enable/disable.
#define vec_elt(v, i)
Get vector value at index i.
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
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)
Set bridge-domain unkown-unicast flood enable/disable.
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)
Get vtag tag rewrite on the given interface.
#define vec_foreach(var, vec)
Vector iterator.
#define clib_error_return(e, args...)
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".