解密流量转发时若获取不到 src mac,则使用默认的 src mac 进行填充
This commit is contained in:
@@ -553,6 +553,9 @@ errout:
|
||||
return -1;
|
||||
}
|
||||
|
||||
const static ether_addr zero_mac = {0};
|
||||
const static unsigned char default_mac[6] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
|
||||
|
||||
int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thread_id,
|
||||
enum tfe_conn_dir dir, void ** pme)
|
||||
{
|
||||
@@ -618,10 +621,10 @@ int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thr
|
||||
ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_MAC, (unsigned char *) &c_ether_addr,
|
||||
sizeof(c_ether_addr), &opt_out_size);
|
||||
|
||||
if (ret < 0)
|
||||
if (ret < 0 || memcmp(&c_ether_addr, &zero_mac, sizeof(c_ether_addr)) == 0)
|
||||
{
|
||||
TFE_LOG_ERROR(instance->logger, "failed at source mac address, detach the stream.");
|
||||
goto detach;
|
||||
TFE_LOG_ERROR(instance->logger, "failed at source mac address, user default src mac.");
|
||||
memcpy(&c_ether_addr, &default_mac, sizeof(c_ether_addr));
|
||||
}
|
||||
|
||||
ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_DST_MAC, (unsigned char *) &s_ether_addr,
|
||||
|
||||
Reference in New Issue
Block a user