perf: Add default dst MAC for VXLAN encapsulate when disable health_check_module

This commit is contained in:
luwenpeng
2023-10-20 18:38:40 +08:00
parent a49805a019
commit 5f4ec8b4a9
2 changed files with 6 additions and 0 deletions

View File

@@ -75,6 +75,8 @@ telegraf_listen_port=8300
[bfdd] [bfdd]
enable=1 enable=1
# use default_gw_mac when enable = 0
default_gw_mac=aa:aa:aa:aa:aa:aa
path=/run/run/frr/bfdd.vty path=/run/run/frr/bfdd.vty
device=eth0 device=eth0
local_address=127.0.0.1 local_address=127.0.0.1

View File

@@ -314,6 +314,7 @@ static int send_icmp_cycle()
void health_check_session_init(const char *profile) void health_check_session_init(const char *profile)
{ {
char default_gw_mac_str[32] = { 0 };
memset(&g_handle, 0, sizeof(g_handle)); memset(&g_handle, 0, sizeof(g_handle));
pthread_rwlock_init(&g_handle.rwlock, NULL); pthread_rwlock_init(&g_handle.rwlock, NULL);
memset(&g_handle_bfd, 0, sizeof(g_handle_bfd)); memset(&g_handle_bfd, 0, sizeof(g_handle_bfd));
@@ -326,9 +327,11 @@ void health_check_session_init(const char *profile)
MESA_load_profile_string_def(profile, "bfdd", "device", hc_dev_name, sizeof(hc_dev_name), "eth0"); 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", "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_def(profile, "bfdd", "gateway", gateway_address, sizeof(gateway_address), "127.0.0.1");
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) if (enable == 0)
{ {
str_to_mac(default_gw_mac_str, default_gw_mac);
return; return;
} }
@@ -721,6 +724,7 @@ int health_check_session_get_mac(uint64_t session_id, u_char mac_buff[])
if (enable == 0) if (enable == 0)
{ {
memcpy(mac_buff, default_gw_mac, ETH_ALEN);
return 0; return 0;
} }
pthread_rwlock_rdlock(&g_handle.rwlock); pthread_rwlock_rdlock(&g_handle.rwlock);