TSG-13921 tsg-service-chaining-engine支持与mrzcpd保活
This commit is contained in:
@@ -163,6 +163,10 @@ static int handle_session_resetall(struct metadata *meta, struct ctrl_pkt_parser
|
||||
|
||||
static void session_value_free_cb(void *ctx);
|
||||
|
||||
// return 0 : not keepalive packet
|
||||
// return 1 : is keepalive packet
|
||||
static int marsio_buff_is_keepalive(marsio_buff_t *rx_buff);
|
||||
|
||||
/******************************************************************************
|
||||
* API Definition
|
||||
******************************************************************************/
|
||||
@@ -334,6 +338,14 @@ int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, voi
|
||||
{
|
||||
marsio_buff_t *rx_buff = rx_buffs[j];
|
||||
int raw_len = marsio_buff_datalen(rx_buff);
|
||||
|
||||
if (marsio_buff_is_keepalive(rx_buff))
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->keepalive_packet_rx, 1, raw_len);
|
||||
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (marsio_buff_is_ctrlbuf(rx_buff))
|
||||
{
|
||||
handle_control_packet(handle, rx_buff, thread_seq, ctx);
|
||||
@@ -1330,4 +1342,26 @@ static void session_value_free_cb(void *ctx)
|
||||
{
|
||||
struct session_ctx *s_ctx = (struct session_ctx *)ctx;
|
||||
session_ctx_free(s_ctx);
|
||||
}
|
||||
|
||||
// return 0 : not keepalive packet
|
||||
// return 1 : is keepalive packet
|
||||
static int marsio_buff_is_keepalive(marsio_buff_t *rx_buff)
|
||||
{
|
||||
int raw_len = marsio_buff_datalen(rx_buff);
|
||||
char *raw_data = marsio_buff_mtod(rx_buff);
|
||||
if (raw_data == NULL || raw_len == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ethhdr *eth_hdr = (struct ethhdr *)raw_data;
|
||||
if (eth_hdr->h_proto == 0xAAAA)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user