aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lldp/lldp_cli.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-10-02 14:12:37 +0000
committerDamjan Marion <dmarion@me.com>2020-10-02 22:20:59 +0000
commit149fd3fbd069a5f7be86e68472578ee7af229cb6 (patch)
tree9c815f7e1edf9f7cbb2c86e93459e4989ba21f00 /src/plugins/lldp/lldp_cli.c
parent1c556d19d0b7a0f9d130ddfb07041cb2cafb8a8d (diff)
lldp: set interface MAC address when enabled
Type: improvement Change-Id: I4f2dc4e4c1c467fb9acd0fed231c56fcd54c8da9 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/plugins/lldp/lldp_cli.c')
-rw-r--r--src/plugins/lldp/lldp_cli.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/lldp/lldp_cli.c b/src/plugins/lldp/lldp_cli.c
index 0d196f4e394..da45ba3043b 100644
--- a/src/plugins/lldp/lldp_cli.c
+++ b/src/plugins/lldp/lldp_cli.c
@@ -39,6 +39,8 @@ lldp_cfg_err_to_clib_err (lldp_cfg_err_t e)
return clib_error_return (0, "not supported");
case lldp_invalid_arg:
return clib_error_return (0, "invalid argument");
+ case lldp_internal_error:
+ return clib_error_return (0, "internal error");
}
return 0;
}
@@ -99,6 +101,13 @@ lldp_cfg_intf_set (u32 hw_if_index, u8 ** port_desc, u8 ** mgmt_ip4,
*mgmt_oid = NULL;
}
+ if (!vnet_hw_interface_add_del_mac_address (lm->vnet_main, hw_if_index,
+ lldp_mac_addr,
+ 1 /* is_add */ ))
+ {
+ return lldp_internal_error;
+ }
+
const vnet_sw_interface_t *sw =
vnet_get_sw_interface (lm->vnet_main, hi->sw_if_index);
if (sw->flags & (VNET_SW_INTERFACE_FLAG_ADMIN_UP))
@@ -110,6 +119,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)
+ {
+ vnet_hw_interface_add_del_mac_address (lm->vnet_main, hw_if_index,
+ lldp_mac_addr,
+ 0 /* is_add */ );
+ }
}
return lldp_ok;