166 #define BD_REMOVE_ERROR_OK 0 167 #define BD_REMOVE_ERROR_NOT_FOUND 1 230 u32 feature_bitmap = 0;
239 feature_bitmap |= L2INPUT_FEAT_LEARN;
243 feature_bitmap |= L2INPUT_FEAT_FWD;
247 feature_bitmap |= L2INPUT_FEAT_FLOOD;
251 feature_bitmap |= L2INPUT_FEAT_UU_FLOOD;
255 feature_bitmap |= L2INPUT_FEAT_ARP_TERM;
308 if (!
unformat (input,
"%d", &bd_id))
353 .path =
"set bridge-domain learn",
354 .short_help =
"set bridge-domain learn <bridge-domain-id> [disable]",
373 if (!
unformat (input,
"%d", &bd_id))
419 .path =
"set bridge-domain forward",
420 .short_help =
"set bridge-domain forward <bridge-domain-id> [disable]",
440 if (!
unformat (input,
"%d", &bd_id))
485 .path =
"set bridge-domain flood",
486 .short_help =
"set bridge-domain flood <bridge-domain-id> [disable]",
506 if (!
unformat (input,
"%d", &bd_id))
551 .path =
"set bridge-domain uu-flood",
552 .short_help =
"set bridge-domain uu-flood <bridge-domain-id> [disable]",
572 if (!
unformat (input,
"%d", &bd_id))
611 if (!
unformat (input,
"%d", &bd_id))
660 .path =
"set bridge-domain mac-age",
661 .short_help =
"set bridge-domain mac-age <bridge-domain-id> <mins>",
678 .path =
"set bridge-domain arp term",
679 .short_help =
"set bridge-domain arp term <bridge-domain-id> [disable]",
698 u8 * ip_addr,
u8 * mac_addr,
u8 is_ip6,
u8 is_add)
702 u64 new_mac = *(
u64 *) mac_addr;
704 u16 *mac16 = (
u16 *) & new_mac;
721 else if (*old_mac == new_mac)
734 if (old_mac && (*old_mac == new_mac))
751 if (old_mac && (*old_mac == new_mac))
757 if (old_mac && (*old_mac == new_mac))
784 if (!
unformat (input,
"%d", &bd_id))
829 is_add ?
"add" :
"del",
850 .path =
"set bridge-domain arp entry",
851 .short_help =
"set bridge-domain arp entry <bridge-domain-id> <ip-addr> <mac-addr> [del]",
859 u32 vtr_op = va_arg (*args,
u32);
860 u32 dot1q = va_arg (*args,
u32);
861 u32 tag1 = va_arg (*args,
u32);
862 u32 tag2 = va_arg (*args,
u32);
866 return format (s,
"none");
868 return format (s,
"push-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
870 return format (s,
"push-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad", tag1,
873 return format (s,
"pop-1");
875 return format (s,
"pop-2");
877 return format (s,
"trans-1-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
879 return format (s,
"trans-1-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
882 return format (s,
"trans-2-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
884 return format (s,
"trans-2-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
887 return format (s,
"none");
948 for (bd_index = start; bd_index < end; bd_index++)
957 "%=5s %=7s %=4s %=9s %=9s %=9s %=9s %=9s %=9s %=9s",
958 "ID",
"Index",
"BSN",
"Age(min)",
"Learning",
959 "U-Forwrd",
"UU-Flood",
"Flooding",
"ARP-Term",
968 "%=5d %=7d %=4d %=9v %=9s %=9s %=9s %=9s %=9s %=9U",
994 u32 vtr_opr, dot1q, tag1, tag2;
998 "Interface",
"If-idx",
"ISN",
"SHG",
999 "BVI",
"TxFlood",
"VLAN-Tag-Rewrite");
1008 "-", i < bd_config->flood_count ?
"*" :
"-",
1013 if ((detail || arp) &&
1020 "\n IP4/IP6 to MAC table for ARP Termination");
1025 vlib_cli_output (vm,
"%=40U => %=20U",
1026 format_ip4_address, &ip4_addr,
1027 format_ethernet_address, &mac_addr);
1032 vlib_cli_output (vm,
"%=40U => %=20U",
1033 format_ip6_address, ip6_addr,
1034 format_ethernet_address, &mac_addr);
1078 .path =
"show bridge-domain",
1079 .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)
sll srl srl sll sra u16x4 i
u8 * format_vnet_sw_if_index_name_with_NA(u8 *s, va_list *args)
Format sw_if_index.
#define hash_unset(h, key)
vnet_main_t * vnet_get_main(void)
static void update_flood_count(l2_bridge_domain_t *bd_config)
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)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
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
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
vnet_flood_class_t flood_class
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 clib_error_return(e, args...)
#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 void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
void l2fib_flush_bd_mac(vlib_main_t *vm, u32 bd_index)
Flush all learned MACs in a bridge domain.
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.
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.
#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
void bd_set_mac_age(vlib_main_t *vm, u32 bd_index, u8 age)
Set the mac age for the bridge domain.
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.
#define vec_free(V)
Free vector's memory (no header).
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)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
#define vec_insert_elts(V, E, N, M)
Insert N vector elements starting at element M, insert given elements (no header, unspecified alignme...
static void clib_mem_free(void *p)
static void * clib_mem_alloc(uword size)
static vlib_main_t * vlib_get_main(void)
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.
static clib_error_t * bd_mac_age(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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.
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
vlib_node_registration_t l2fib_mac_age_scanner_process_node
(constructor) VLIB_REGISTER_NODE (l2fib_mac_age_scanner_process_node)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".