summaryrefslogtreecommitdiff
path: root/dlpisubs.c
diff options
context:
space:
mode:
authorJoseph Mingrone <jrm@FreeBSD.org>2024-09-05 16:46:35 -0300
committerJoseph Mingrone <jrm@FreeBSD.org>2024-09-05 16:46:35 -0300
commit025be3f592b920ff0a3e602e5aa8b60a34e5e617 (patch)
tree4f33277584e4a38c8bad5c2788584a00cf830ea4 /dlpisubs.c
parent6b96668d5b49eea57b7551349eca70928cc199ce (diff)
Import libpcap 1.10.5vendor/libpcap/1.10.5
Diffstat (limited to 'dlpisubs.c')
-rw-r--r--dlpisubs.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/dlpisubs.c b/dlpisubs.c
index 6815b0ec2cba..e1a64492d497 100644
--- a/dlpisubs.c
+++ b/dlpisubs.c
@@ -11,9 +11,7 @@
* by pcap-[dlpi,libdlpi].c.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#ifndef DL_IPATM
#define DL_IPATM 0x12 /* ATM Classical IP interface */
@@ -195,7 +193,7 @@ pcap_process_pkts(pcap_t *p, pcap_handler callback, u_char *user,
bufp += caplen;
#endif
++pd->stat.ps_recv;
- if (pcap_filter(p->fcode.bf_insns, pk, origlen, caplen)) {
+ if (pcapint_filter(p->fcode.bf_insns, pk, origlen, caplen)) {
#ifdef HAVE_SYS_BUFMOD_H
pkthdr.ts.tv_sec = sbp->sbh_timestamp.tv_sec;
pkthdr.ts.tv_usec = sbp->sbh_timestamp.tv_usec;
@@ -246,14 +244,14 @@ pcap_process_mactype(pcap_t *p, u_int mactype)
* Ethernet framing).
*/
p->dlt_list = (u_int *)malloc(sizeof(u_int) * 2);
- /*
- * If that fails, just leave the list empty.
- */
- if (p->dlt_list != NULL) {
- p->dlt_list[0] = DLT_EN10MB;
- p->dlt_list[1] = DLT_DOCSIS;
- p->dlt_count = 2;
+ if (p->dlt_list == NULL) {
+ pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
+ errno, "malloc");
+ return (-1);
}
+ p->dlt_list[0] = DLT_EN10MB;
+ p->dlt_list[1] = DLT_DOCSIS;
+ p->dlt_count = 2;
break;
case DL_FDDI:
@@ -377,7 +375,7 @@ pcap_alloc_databuf(pcap_t *p)
p->bufsize = PKTBUFSIZE;
p->buffer = malloc(p->bufsize + p->offset);
if (p->buffer == NULL) {
- pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
+ pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
errno, "malloc");
return (-1);
}
@@ -412,6 +410,6 @@ strioctl(int fd, int cmd, int len, char *dp)
static void
pcap_stream_err(const char *func, int err, char *errbuf)
{
- pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, err, "%s", func);
+ pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, err, "%s", func);
}
#endif