bugfix:增加异常处理
This commit is contained in:
@@ -922,7 +922,6 @@ static void send_event_log(struct session_ctx *s_ctx, int thread_seq, void *ctx)
|
|||||||
// finish writing
|
// finish writing
|
||||||
if (mpack_writer_destroy(&writer) != mpack_ok)
|
if (mpack_writer_destroy(&writer) != mpack_ok)
|
||||||
{
|
{
|
||||||
assert(0);
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
free(data);
|
free(data);
|
||||||
@@ -935,6 +934,13 @@ static void send_event_log(struct session_ctx *s_ctx, int thread_seq, void *ctx)
|
|||||||
int raw_packet_header_len = s_ctx->ctrl_meta->l7offset;
|
int raw_packet_header_len = s_ctx->ctrl_meta->l7offset;
|
||||||
marsio_buff_malloc_global(packet_io->instance, tx_buffs, 1, 0, thread_seq);
|
marsio_buff_malloc_global(packet_io->instance, tx_buffs, 1, 0, thread_seq);
|
||||||
char *dst = marsio_buff_append(tx_buffs[0], raw_packet_header_len + size);
|
char *dst = marsio_buff_append(tx_buffs[0], raw_packet_header_len + size);
|
||||||
|
if (dst == NULL)
|
||||||
|
{
|
||||||
|
TFE_LOG_ERROR(logger, "%s: unable to send log_update packet, get marsio buff is NULL.", LOG_TAG_PKTIO);
|
||||||
|
if (data)
|
||||||
|
free(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
memcpy(dst, raw_packet_header_data, raw_packet_header_len);
|
memcpy(dst, raw_packet_header_data, raw_packet_header_len);
|
||||||
memcpy(dst + raw_packet_header_len, data, size);
|
memcpy(dst + raw_packet_header_len, data, size);
|
||||||
|
|
||||||
@@ -1037,6 +1043,11 @@ static void packet_io_send_fake_pkt(struct packet_io_thread_ctx *thread, struct
|
|||||||
{
|
{
|
||||||
meta.raw_len = fn[i](info, client_mac, server_mac, buffer, sizeof(buffer));
|
meta.raw_len = fn[i](info, client_mac, server_mac, buffer, sizeof(buffer));
|
||||||
meta.raw_data = marsio_buff_append(tx_buffs[i], meta.raw_len);
|
meta.raw_data = marsio_buff_append(tx_buffs[i], meta.raw_len);
|
||||||
|
if (meta.raw_data == NULL)
|
||||||
|
{
|
||||||
|
TFE_LOG_ERROR(logger, "%s: unable to send fake packet, get marsio buff is NULL.", LOG_TAG_PKTIO);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
memcpy(meta.raw_data, buffer, meta.raw_len);
|
memcpy(meta.raw_data, buffer, meta.raw_len);
|
||||||
|
|
||||||
switch (i)
|
switch (i)
|
||||||
@@ -1914,6 +1925,12 @@ void handle_decryption_packet_from_tap(const char *data, int len, void *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *dst = marsio_buff_append(tx_buffs[0], len);
|
char *dst = marsio_buff_append(tx_buffs[0], len);
|
||||||
|
if (dst == NULL)
|
||||||
|
{
|
||||||
|
throughput_metrics_inc(&packet_io_fs->decrypt_rxdrop, 1, len);
|
||||||
|
TFE_LOG_ERROR(logger, "%s: unable to send decryption packet, get marsio buff is NULL.", LOG_TAG_PKTIO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
memcpy(dst, data, len);
|
memcpy(dst, data, len);
|
||||||
|
|
||||||
struct metadata meta = {0};
|
struct metadata meta = {0};
|
||||||
@@ -2009,12 +2026,24 @@ void handle_raw_packet_from_tap(const char *data, int len, void *args)
|
|||||||
if (header != NULL) {
|
if (header != NULL) {
|
||||||
packet_len = len + header_len - sizeof(struct ethhdr);
|
packet_len = len + header_len - sizeof(struct ethhdr);
|
||||||
dst = marsio_buff_append(tx_buffs[0], packet_len);
|
dst = marsio_buff_append(tx_buffs[0], packet_len);
|
||||||
|
if (dst == NULL)
|
||||||
|
{
|
||||||
|
throughput_metrics_inc(&packet_io_fs->tap_pkt_rxdrop, 1, len);
|
||||||
|
TFE_LOG_ERROR(logger, "%s: unable to send raw packet, get marsio buff is NULL.", LOG_TAG_PKTIO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
memcpy(dst, header, header_len);
|
memcpy(dst, header, header_len);
|
||||||
memcpy(dst + header_len, data + sizeof(struct ethhdr), len - sizeof(struct ethhdr));
|
memcpy(dst + header_len, data + sizeof(struct ethhdr), len - sizeof(struct ethhdr));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
packet_len = len;
|
packet_len = len;
|
||||||
dst = marsio_buff_append(tx_buffs[0], len);
|
dst = marsio_buff_append(tx_buffs[0], len);
|
||||||
|
if (dst == NULL)
|
||||||
|
{
|
||||||
|
throughput_metrics_inc(&packet_io_fs->tap_pkt_rxdrop, 1, len);
|
||||||
|
TFE_LOG_ERROR(logger, "%s: unable to send raw packet, get marsio buff is NULL.", LOG_TAG_PKTIO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
memcpy(dst, data, len);
|
memcpy(dst, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user