From b4e0025e30823b40e71ab00b3c0061a4507ed1c2 Mon Sep 17 00:00:00 2001 From: wangmenglan Date: Mon, 25 Dec 2023 11:04:58 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=20TSG-18106:=E5=88=A0=E9=99=A4SCE?= =?UTF-8?q?=E7=BD=91=E5=85=B3=E9=BB=98=E8=AE=A4=E5=80=BC127.0.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/src/health_check.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/src/health_check.cpp b/platform/src/health_check.cpp index 7096eae..726e852 100644 --- a/platform/src/health_check.cpp +++ b/platform/src/health_check.cpp @@ -349,7 +349,7 @@ void health_check_session_init(const char *profile) MESA_load_profile_string_def(profile, "bfdd", "path", path, sizeof(path), "/var/run/frr/bfdd.vty"); MESA_load_profile_string_def(profile, "bfdd", "device", hc_dev_name, sizeof(hc_dev_name), "eth0"); MESA_load_profile_string_def(profile, "bfdd", "local_address", local_address, sizeof(local_address), "127.0.0.1"); - MESA_load_profile_string_def(profile, "bfdd", "gateway", gateway_address, sizeof(gateway_address), "127.0.0.1"); + MESA_load_profile_string_nodef(profile, "bfdd", "gateway", gateway_address, sizeof(gateway_address)); MESA_load_profile_string_def(profile, "bfdd", "default_gw_mac", default_gw_mac_str, sizeof(default_gw_mac_str), "aa:aa:aa:aa:aa:aa"); if (enable == 0) @@ -359,7 +359,9 @@ void health_check_session_init(const char *profile) } g_sf_status = sf_status_create(profile); - health_check_method_table_add(&g_handle_none, gateway_address); + if (strlen(gateway_address) > 0) { + health_check_method_table_add(&g_handle_none, gateway_address); + } health_check_session_foreach(); listen_arp_table(); send_icmp_cycle(); @@ -773,6 +775,12 @@ int health_check_session_get_mac(uint64_t session_id, u_char mac_buff[]) } if (memcmp(mac, init_mac, ETH_ALEN) == 0) { + if (strlen(gateway_address) == 0) { + LOG_DEBUG("health check session id [%lu] profile id [%d] health check method [%s] get mac [null]", session_id, tmp->profile_id, str_method); + pthread_rwlock_unlock(&g_handle.rwlock); + return -1; + } + health_check_method_table_get_mac(&g_handle_none, gateway_address, mac); if (memcmp(mac, init_mac, ETH_ALEN) == 0) { LOG_DEBUG("health check session id [%lu] profile id [%d] health check method [%s] get mac [null]", session_id, tmp->profile_id, str_method);