138 bd_config->
members[0] = *member;
143 #define BD_REMOVE_ERROR_OK 0 144 #define BD_REMOVE_ERROR_NOT_FOUND 1 194 u32 feature_bitmap = 0;
203 feature_bitmap |= L2INPUT_FEAT_LEARN;
207 feature_bitmap |= L2INPUT_FEAT_FWD;
211 feature_bitmap |= L2INPUT_FEAT_FLOOD;
215 feature_bitmap |= L2INPUT_FEAT_UU_FLOOD;
219 feature_bitmap |= L2INPUT_FEAT_ARP_TERM;
249 if (!
unformat (input,
"%d", &bd_id))
294 .path =
"set bridge-domain learn",
295 .short_help =
"set bridge-domain learn <bridge-domain-id> [disable]",
314 if (!
unformat (input,
"%d", &bd_id))
360 .path =
"set bridge-domain forward",
361 .short_help =
"set bridge-domain forward <bridge-domain-id> [disable]",
381 if (!
unformat (input,
"%d", &bd_id))
426 .path =
"set bridge-domain flood",
427 .short_help =
"set bridge-domain flood <bridge-domain-id> [disable]",
447 if (!
unformat (input,
"%d", &bd_id))
492 .path =
"set bridge-domain uu-flood",
493 .short_help =
"set bridge-domain uu-flood <bridge-domain-id> [disable]",
513 if (!
unformat (input,
"%d", &bd_id))
554 .path =
"set bridge-domain arp term",
555 .short_help =
"set bridge-domain arp term <bridge-domain-id> [disable]",
574 u8 * ip_addr,
u8 * mac_addr,
u8 is_ip6,
u8 is_add)
578 u64 new_mac = *(
u64 *) mac_addr;
580 u16 *mac16 = (
u16 *) & new_mac;
597 else if (*old_mac == new_mac)
610 if (old_mac && (*old_mac == new_mac))
627 if (old_mac && (*old_mac == new_mac))
633 if (old_mac && (*old_mac == new_mac))
660 if (!
unformat (input,
"%d", &bd_id))
705 is_add ?
"add" :
"del",
726 .path =
"set bridge-domain arp entry",
727 .short_help =
"set bridge-domain arp entry <bridge-domain-id> <ip-addr> <mac-addr> [del]",
735 u32 vtr_op = va_arg (*args,
u32);
736 u32 dot1q = va_arg (*args,
u32);
737 u32 tag1 = va_arg (*args,
u32);
738 u32 tag2 = va_arg (*args,
u32);
742 return format (s,
"none");
744 return format (s,
"push-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
746 return format (s,
"push-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad", tag1,
749 return format (s,
"pop-1");
751 return format (s,
"pop-2");
753 return format (s,
"trans-1-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
755 return format (s,
"trans-1-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
758 return format (s,
"trans-2-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
760 return format (s,
"trans-2-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
763 return format (s,
"none");
824 for (bd_index = start; bd_index < end; bd_index++)
833 "%=5s %=7s %=10s %=10s %=10s %=10s %=10s %=14s",
834 "ID",
"Index",
"Learning",
"U-Forwrd",
835 "UU-Flood",
"Flooding",
"ARP-Term",
840 "%=5d %=7d %=10s %=10s %=10s %=10s %=10s %=14U",
841 bd_config->
bd_id, bd_index,
863 u32 vtr_opr, dot1q, tag1, tag2;
868 "Interface",
"Index",
"SHG",
"BVI",
882 if ((detail || arp) &&
889 "\n IP4/IP6 to MAC table for ARP Termination");
894 vlib_cli_output (vm,
"%=40U => %=20U",
895 format_ip4_address, &ip4_addr,
896 format_ethernet_address, &mac_addr);
901 vlib_cli_output (vm,
"%=40U => %=20U",
902 format_ip6_address, ip6_addr,
903 format_ethernet_address, &mac_addr);
946 .path =
"show bridge-domain",
947 .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. ...
#define hash_set_mem(h, key, value)
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.
#define hash_get_pair(h, key)
uword * bd_index_by_bd_id
#define BD_REMOVE_ERROR_OK
#define hash_create_mem(elts, key_bytes, value_bytes)
#define hash_unset_mem(h, key)
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,...)
#define hash_foreach_mem(key_var, value_var, h, body)
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.
#define clib_memcpy(a, b, c)
#define VLIB_CLI_COMMAND(x,...)
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 void clib_mem_free(void *p)
static void * clib_mem_alloc(uword size)
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.
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)
#define hash_get_mem(h, key)
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".