session manager support tcp reassembly

This commit is contained in:
luwenpeng
2024-03-26 15:09:03 +08:00
parent 5b92d6d8de
commit eb281ab789
30 changed files with 1917 additions and 88 deletions

View File

@@ -68,20 +68,23 @@ static void pcap_handle(u_char *user, const struct pcap_pkthdr *h, const u_char
static int dumpfile_handle(const char *file, void *arg)
{
char resolved_path[256];
char pcap_errbuf[PCAP_ERRBUF_SIZE];
struct packet_io_dumpfile *handle = (struct packet_io_dumpfile *)arg;
PACKET_IO_LOG_STATE("dumpfile %s in-processing", file)
realpath(file, resolved_path);
PACKET_IO_LOG_STATE("dumpfile %s in-processing", resolved_path)
handle->pcap = pcap_open_offline(file, NULL);
handle->pcap = pcap_open_offline(file, pcap_errbuf);
if (handle->pcap == NULL)
{
PACKET_IO_LOG_ERROR("unable to open pcap file: %s", file);
PACKET_IO_LOG_ERROR("unable to open pcap file: %s, %s", resolved_path, pcap_errbuf);
return -1;
}
pcap_loop(handle->pcap, -1, pcap_handle, (u_char *)handle);
pcap_close(handle->pcap);
PACKET_IO_LOG_STATE("dumpfile %s processed", file)
PACKET_IO_LOG_STATE("dumpfile %s processed", resolved_path)
return 0;
}