TSG-13912 支持对第三方设备健康检查
bfdd程序重启后, 支持将配置重新下发给bfdd程序
This commit is contained in:
@@ -80,6 +80,22 @@ void health_check_session_init(const char *profile)
|
||||
health_check_session_foreach();
|
||||
}
|
||||
|
||||
static int health_check_session_recover_cfg(struct bfd_vtysh_client *client)
|
||||
{
|
||||
int ret = 0;
|
||||
struct session_iterm *tmp = NULL;
|
||||
struct session_iterm *node = NULL;
|
||||
HASH_ITER(hh1, g_handle.root_by_id, node, tmp) {
|
||||
if (node->policy.method != HEALTH_CHECK_METHOD_BFD)
|
||||
continue;
|
||||
|
||||
ret = bfd_vtysh_add_dev(client, node->policy.address, node->policy.retires, node->policy.interval_ms);
|
||||
if (ret != 0)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void health_check_session_init_bfd_client(struct bfd_vtysh_client *client)
|
||||
{
|
||||
memset(client, 0, sizeof(*client));
|
||||
@@ -87,6 +103,14 @@ static void health_check_session_init_bfd_client(struct bfd_vtysh_client *client
|
||||
client->pre_config = bfd_vtysh_pre_config;
|
||||
}
|
||||
|
||||
static void health_check_session_recover_bfd(struct bfd_vtysh_client *client)
|
||||
{
|
||||
memset(client, 0, sizeof(*client));
|
||||
snprintf(client->path, sizeof(client->path), path);
|
||||
client->pre_config = bfd_vtysh_pre_config;
|
||||
client->recover_config = health_check_session_recover_cfg;
|
||||
}
|
||||
|
||||
// return 0 : success
|
||||
// return -1 : key exist
|
||||
// struct health_check *policy : need deep copy
|
||||
@@ -264,8 +288,15 @@ static void *_health_check_session_foreach(void *arg)
|
||||
continue;
|
||||
|
||||
is_active = bfd_vtysh_get_dev_active(&client, node->policy.address);
|
||||
if (is_active == -1)
|
||||
continue;
|
||||
if (is_active == -1) {
|
||||
bfd_vtysh_close(&client);
|
||||
health_check_session_recover_bfd(&client);
|
||||
bfd_vtysh_connect(&client);
|
||||
is_active = bfd_vtysh_get_dev_active(&client, node->policy.address);
|
||||
if (is_active == -1)
|
||||
is_active = 0;
|
||||
}
|
||||
|
||||
if (node->is_active != is_active) {
|
||||
node->is_active = is_active;
|
||||
if (node->is_active == 1) {
|
||||
|
||||
Reference in New Issue
Block a user