summaryrefslogtreecommitdiffstats
path: root/src/plugins/lldp/lldp_cli.c
diff options
context:
space:
mode:
authorDmitry Vakhrushev <dmitry@netgate.com>2020-10-16 23:39:28 +0300
committerMatthew Smith <mgsmith@netgate.com>2020-11-19 21:54:57 +0000
commit4a98cf9648bc6852be9ba6622dc633f2168a7f66 (patch)
tree618ad895e22ac8b33acf194e591b173d8b3d34d3 /src/plugins/lldp/lldp_cli.c
parent91b364010cc81260f81af19bae6fd5ec22ee3b90 (diff)
lldp: allow to configure restricted interfaces
This improvement intended to allow sending of LLDP packets on an interface even if the interface cannot support programming an extra MAC address in order to receive LLDP messages from the attached link peer. vnet_hw_interface_add_del_mac_address function fails on some 'virtio' interfaces due to limitation to set MAC addresses. Type: improvement Change-Id: I636de148736a0797d1fd70c6ab14759ff8fa42be Signed-off-by: Dmitry Vakrhushev <dmitry@netgate.com>
Diffstat (limited to 'src/plugins/lldp/lldp_cli.c')
-rw-r--r--src/plugins/lldp/lldp_cli.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/plugins/lldp/lldp_cli.c b/src/plugins/lldp/lldp_cli.c
index d2cdf120e6e..ef3fccc8b4b 100644
--- a/src/plugins/lldp/lldp_cli.c
+++ b/src/plugins/lldp/lldp_cli.c
@@ -102,15 +102,20 @@ lldp_cfg_intf_set (u32 hw_if_index, u8 ** port_desc, u8 ** mgmt_ip4,
*mgmt_oid = NULL;
}
- error =
- vnet_hw_interface_add_del_mac_address (lm->vnet_main, hw_if_index,
- lldp_mac_addr,
- 1 /* is_add */ );
- if (error)
+ /* Add MAC address to an interface's filter */
+ if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER)
{
- clib_error_free (error);
- lldp_delete_intf (lm, n);
- 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 =
@@ -124,10 +129,12 @@ lldp_cfg_intf_set (u32 hw_if_index, u8 ** port_desc, u8 ** mgmt_ip4,
{
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))
{
error =
- vnet_hw_interface_add_del_mac_address (lm->vnet_main, hw_if_index,
+ vnet_hw_interface_add_del_mac_address (lm->vnet_main,
+ hw_if_index,
lldp_mac_addr,
0 /* is_add */ );
if (error)