lldp_cfg_intf_set (u32 hw_if_index, u8 ** port_desc, u8 ** mgmt_ip4,
u8 ** mgmt_ip6, u8 ** mgmt_oid, int enable)
{
+ clib_error_t *error = 0;
lldp_main_t *lm = &lldp_main;
vnet_main_t *vnm = lm->vnet_main;
ethernet_main_t *em = ðernet_main;
*mgmt_oid = NULL;
}
- if (!vnet_hw_interface_add_del_mac_address (lm->vnet_main, hw_if_index,
- lldp_mac_addr,
- 1 /* is_add */ ))
+ /* Add MAC address to an interface's filter */
+ if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER)
{
- return lldp_internal_error;
+ error =
+ vnet_hw_interface_add_del_mac_address (lm->vnet_main,
+ hw_if_index,
+ lldp_mac_addr,
+ 1 /* is_add */ );
+ if (error)
+ {
+ clib_error_free (error);
+ lldp_delete_intf (lm, n);
+ return lldp_internal_error;
+ }
}
const vnet_sw_interface_t *sw =
{
lldp_intf_t *n = lldp_get_intf (lm, hi->sw_if_index);
lldp_delete_intf (lm, n);
- if (n)
+ /* Remove MAC address from the interface's filter */
+ if ((n) && (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER))
{
- vnet_hw_interface_add_del_mac_address (lm->vnet_main, hw_if_index,
- lldp_mac_addr,
- 0 /* is_add */ );
+ error =
+ vnet_hw_interface_add_del_mac_address (lm->vnet_main,
+ hw_if_index,
+ lldp_mac_addr,
+ 0 /* is_add */ );
+ if (error)
+ {
+ clib_error_free (error);
+ }
}
}
f64 now = vlib_time_now (vm);
/* *INDENT-OFF* */
- pool_foreach(
- n, lm->intfs, ({
+ pool_foreach (
+ n, lm->intfs) {
hw = vnet_get_hw_interface(vnm, n->hw_if_index);
sw = vnet_get_sw_interface(lm->vnet_main, hw->sw_if_index);
vec_len(n->port_id), 1, format_time_ago, n->last_sent,
now, format_time_ago, n->last_heard, now);
}
- }));
+ }
/* *INDENT-ON* */
return s;
}
"Status");
/* *INDENT-OFF* */
- pool_foreach(
- n, lm->intfs, ({
+ pool_foreach (
+ n, lm->intfs) {
const vnet_hw_interface_t *hw =
vnet_get_hw_interface(vnm, n->hw_if_index);
const vnet_sw_interface_t *sw =
"", "", format_time_ago, n->last_heard, now,
format_time_ago, n->last_sent, now, "inactive");
}
- }));
+ }
/* *INDENT-ON* */
return s;
}