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);