TSG-13630 tsg-service-chaining-engine使用mrzcpd捕获报文/回注报文

TSG-13685 tsg-service-chaining-engine使用VXLAN封装Steering/Mirroring的Package
This commit is contained in:
luwenpeng
2023-02-10 14:22:40 +08:00
parent 158e4e89e8
commit 737ca3d4be
23 changed files with 2397 additions and 358 deletions

View File

@@ -1,6 +1,7 @@
#include <assert.h>
#include "session_table.h"
#include "utils.h"
#include "log.h"
struct session_table
@@ -66,7 +67,7 @@ int session_table_insert(struct session_table *table, uint64_t session_id, const
HASH_FIND(hh1, table->root_by_id, &session_id, sizeof(session_id), temp);
if (temp)
{
LOG_DEBUG("session table insert: key %lu exists", session_id);
LOG_DEBUG("%s: insert: key %lu exists", LOG_TAG_STABLE, session_id);
return -1;
}
@@ -81,7 +82,7 @@ int session_table_insert(struct session_table *table, uint64_t session_id, const
HASH_ADD(hh1, table->root_by_id, session_id, sizeof(temp->session_id), temp);
HASH_ADD(hh2, table->root_by_addr, session_addr, sizeof(temp->session_addr), temp);
LOG_DEBUG("session table insert: key %lu success", session_id);
LOG_DEBUG("%s: insert: key %lu success", LOG_TAG_STABLE, session_id);
table->session_node_count++;
return 0;
@@ -93,7 +94,7 @@ int session_table_delete_by_id(struct session_table *table, uint64_t session_id)
HASH_FIND(hh1, table->root_by_id, &session_id, sizeof(session_id), temp);
if (!temp)
{
LOG_DEBUG("session table delete: key %lu not exists", session_id);
LOG_DEBUG("%s: delete: key %lu not exists", LOG_TAG_STABLE, session_id);
return -1;
}
@@ -109,7 +110,7 @@ int session_table_delete_by_id(struct session_table *table, uint64_t session_id)
free(temp);
temp = NULL;
LOG_DEBUG("session table delete: key %lu success", session_id);
LOG_DEBUG("%s: delete: key %lu success", LOG_TAG_STABLE, session_id);
table->session_node_count--;
return 0;
@@ -127,7 +128,7 @@ int session_table_delete_by_addr(struct session_table *table, const struct addr_
HASH_FIND(hh2, table->root_by_addr, &reverse_addr, sizeof(struct addr_tuple4), temp);
if (!temp)
{
LOG_DEBUG("session table delete: key %s not exists", addr_str);
LOG_DEBUG("%s: delete: key %s not exists", LOG_TAG_STABLE, addr_str);
free(addr_str);
return -1;
}
@@ -145,7 +146,7 @@ int session_table_delete_by_addr(struct session_table *table, const struct addr_
free(temp);
temp = NULL;
LOG_DEBUG("session table delete: key %s success", addr_str);
LOG_DEBUG("%s: delete: key %s success", LOG_TAG_STABLE, addr_str);
free(addr_str);
addr_str = NULL;
table->session_node_count--;
@@ -159,11 +160,11 @@ struct session_node *session_table_search_by_id(struct session_table *table, uin
HASH_FIND(hh1, table->root_by_id, &session_id, sizeof(session_id), temp);
if (!temp)
{
LOG_DEBUG("session table search: key %lu not exists", session_id);
LOG_DEBUG("%s: search: key %lu not exists", LOG_TAG_STABLE, session_id);
return NULL;
}
LOG_DEBUG("session table search: key %lu success", session_id);
LOG_DEBUG("%s: search: key %lu success", LOG_TAG_STABLE, session_id);
return temp;
}
@@ -180,14 +181,14 @@ struct session_node *session_table_search_by_addr(struct session_table *table, c
HASH_FIND(hh2, table->root_by_addr, &reverse_addr, sizeof(struct addr_tuple4), temp);
if (!temp)
{
LOG_DEBUG("session table search: key %s not exists", addr_str);
LOG_DEBUG("%s: search: key %s not exists", LOG_TAG_STABLE, addr_str);
free(addr_str);
addr_str = NULL;
return NULL;
}
}
LOG_DEBUG("session table search: key %s success", addr_str);
LOG_DEBUG("%s: search: key %s success", LOG_TAG_STABLE, addr_str);
free(addr_str);
addr_str = NULL;