Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/light_pcapng_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ int light_get_next_packet(light_pcapng_t *pcapng, light_packet_header *packet_he
light_read_record(pcapng->file, &pcapng->pcapng);

//End of file or something is broken!
if (pcapng == NULL)
if (pcapng == NULL || pcapng->file_info == NULL)
return 0;

light_get_block_info(pcapng->pcapng, LIGHT_INFO_TYPE, &type, NULL);
Expand Down
1 change: 1 addition & 0 deletions src/light_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ light_file light_open(const char *file_name, const __read_mode_t mode)
{
if (light_is_compressed_file(file_name))
{
free(fd);
return light_open_decompression(file_name, mode);
}
fd->file = fopen(file_name, "rb");
Expand Down
7 changes: 1 addition & 6 deletions src/tests/test_feature.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
#include <stdio.h>
#include <stdlib.h>

#ifdef _WIN32
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")
#else
#include <arpa/inet.h>
#endif
Comment on lines -29 to -34
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure about this one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure some tests don't compile / pass on all platforms. This is something we need to fix if we really want to use this fork

#include <arpa/inet.h>

enum feature_description {
FEATURE_PROTOCOL = 0,
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

struct _light_pcapng_mem;
extern int light_pcapng_validate(light_pcapng p0, uint32_t *p1);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_read_packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main(int argc, const char **args) {
pkt_header.interface_id,
pkt_header.data_link,
(int)pkt_header.timestamp.tv_sec,
(int)pkt_header.timestamp.tv_nsec);
(int)pkt_header.timestamp.tv_usec);
if (pkt_header.comment_length > 0)
printf(", comment=\"%s\"\n", pkt_header.comment);
else
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#define TMP_FILE "/tmp/pcapng.tmp"

Expand Down
9 changes: 5 additions & 4 deletions src/tests/test_read_write_packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, const char **args) {
printf("user app is: %s\n", info->user_app_desc);

const char *file_write = "output.pcapng";
light_pcapng_t *pcapng_write = light_pcapng_open_write(file_write, light_create_default_file_info(), 0);
light_pcapng_t *pcapng_write = light_pcapng_open_write(file_write, light_create_default_file_info());

light_pcapng_t *pcapng_append = light_pcapng_open_append(file_append);
//light_pcapng_t *pcapng_write = light_pcapng_open_write(file_write, info);
Expand Down Expand Up @@ -101,12 +101,13 @@ int main(int argc, const char **args) {
pkt_header.interface_id,
pkt_header.data_link,
(int)pkt_header.timestamp.tv_sec,
(int)pkt_header.timestamp.tv_nsec);
(int)pkt_header.timestamp.tv_usec);

char comment[15];
uint16_t comment_len = 15;
char comment[comment_len];
sprintf(comment, "Packet #%d", index);
pkt_header.comment = comment;
pkt_header.comment_length = 15;
pkt_header.comment_length = comment_len;

light_write_packet(pcapng_write, &pkt_header, pkt_data);
light_write_packet(pcapng_append, &pkt_header, pkt_data);
Expand Down