1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-30 11:29:01 +00:00

Update libpcap to 1.10.5

This commit is contained in:
dmiller
2025-04-14 19:06:54 +00:00
parent 2bc341de52
commit aed27d094e
141 changed files with 12626 additions and 9811 deletions

View File

@@ -21,9 +21,7 @@
* sf-pcapng.c - pcapng-file-format-specific code from savefile.c
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <pcap/pcap-inttypes.h>
@@ -203,7 +201,7 @@ struct pcap_ng_if {
uint64_t tsresol; /* time stamp resolution */
tstamp_scale_type_t scale_type; /* how to scale */
uint64_t scale_factor; /* time stamp scale factor for power-of-10 tsresol */
uint64_t tsoffset; /* time stamp offset */
int64_t tsoffset; /* time stamp offset */
};
/*
@@ -263,7 +261,7 @@ read_bytes(FILE *fp, void *buf, size_t bytes_to_read, int fail_on_eof,
amt_read = fread(buf, 1, bytes_to_read, fp);
if (amt_read != bytes_to_read) {
if (ferror(fp)) {
pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
errno, "error reading dump file");
} else {
if (amt_read == 0 && !fail_on_eof)
@@ -460,7 +458,7 @@ get_optvalue_from_block_data(struct block_cursor *cursor,
static int
process_idb_options(pcap_t *p, struct block_cursor *cursor, uint64_t *tsresol,
uint64_t *tsoffset, int *is_binary, char *errbuf)
int64_t *tsoffset, int *is_binary, char *errbuf)
{
struct option_header *opthdr;
void *optvalue;
@@ -595,7 +593,7 @@ add_interface(pcap_t *p, struct interface_description_block *idbp,
{
struct pcap_ng_sf *ps;
uint64_t tsresol;
uint64_t tsoffset;
int64_t tsoffset;
int is_binary;
ps = p->priv;
@@ -820,7 +818,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
amt_read = fread(&total_length, 1, sizeof(total_length), fp);
if (amt_read < sizeof(total_length)) {
if (ferror(fp)) {
pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
errno, "error reading dump file");
*err = 1;
return (NULL); /* fail */
@@ -835,7 +833,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
amt_read = fread(&byte_order_magic, 1, sizeof(byte_order_magic), fp);
if (amt_read < sizeof(byte_order_magic)) {
if (ferror(fp)) {
pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
errno, "error reading dump file");
*err = 1;
return (NULL); /* fail */
@@ -1060,7 +1058,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
done:
p->linktype = linktype_to_dlt(idbp->linktype);
p->snapshot = pcap_adjust_snapshot(p->linktype, idbp->snaplen);
p->snapshot = pcapint_adjust_snapshot(p->linktype, idbp->snaplen);
p->linktype_ext = 0;
/*
@@ -1090,7 +1088,7 @@ pcap_ng_cleanup(pcap_t *p)
struct pcap_ng_sf *ps = p->priv;
free(ps->ifaces);
sf_cleanup(p);
pcapint_sf_cleanup(p);
}
/*
@@ -1261,7 +1259,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
* snapshot length.
*/
if ((bpf_u_int32)p->snapshot !=
pcap_adjust_snapshot(p->linktype, idbp->snaplen)) {
pcapint_adjust_snapshot(p->linktype, idbp->snaplen)) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"an interface has a snapshot length %u different from the snapshot length of the first interface",
idbp->snaplen);
@@ -1489,7 +1487,7 @@ found:
}
#ifdef _WIN32
/*
* tv_sec and tv_used in the Windows struct timeval are both
* tv_sec and tv_usec in the Windows struct timeval are both
* longs.
*/
hdr->ts.tv_sec = (long)sec;
@@ -1512,7 +1510,7 @@ found:
if (*data == NULL)
return (-1);
pcap_post_process(p->linktype, p->swapped, hdr, *data);
pcapint_post_process(p->linktype, p->swapped, hdr, *data);
return (1);
}