aboutsummaryrefslogtreecommitdiff
path: root/dlpisubs.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2018-05-18 12:21:19 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2018-05-18 12:21:19 +0000
commitd109bf9e4b609b5a0626b433e56db4a47dc530bb (patch)
tree48bc2a4852c42b213448a7e9d93f2e5eb6348ea0 /dlpisubs.c
parent2369c04eb959fda4140b71f1c78798251bf43b62 (diff)
downloadsrc-d109bf9e4b609b5a0626b433e56db4a47dc530bb.tar.gz
src-d109bf9e4b609b5a0626b433e56db4a47dc530bb.zip
Import vendor revision 77da77c36e5d958f9b8d6729876a33f670de031f from:
https://github.com/the-tcpdump-group/libpcap.git This among other minor fixes adds support for sniffing RDMA devices. Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/vendor/libpcap/dist/; revision=333789
Diffstat (limited to 'dlpisubs.c')
-rw-r--r--dlpisubs.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/dlpisubs.c b/dlpisubs.c
index fb94a6057675..5f6e41af80b5 100644
--- a/dlpisubs.c
+++ b/dlpisubs.c
@@ -12,7 +12,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#ifndef DL_IPATM
@@ -271,7 +271,16 @@ pcap_process_mactype(pcap_t *p, u_int mactype)
#ifdef DL_IPNET
case DL_IPNET:
- p->linktype = DLT_IPNET;
+ /*
+ * XXX - DL_IPNET devices default to "raw IP" rather than
+ * "IPNET header"; see
+ *
+ * http://seclists.org/tcpdump/2009/q1/202
+ *
+ * We'd have to do DL_IOC_IPNET_INFO to enable getting
+ * the IPNET header.
+ */
+ p->linktype = DLT_RAW;
p->offset = 0;
break;
#endif
@@ -349,7 +358,8 @@ pcap_alloc_databuf(pcap_t *p)
p->bufsize = PKTBUFSIZE;
p->buffer = malloc(p->bufsize + p->offset);
if (p->buffer == NULL) {
- strlcpy(p->errbuf, pcap_strerror(errno), PCAP_ERRBUF_SIZE);
+ pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
+ errno, "malloc");
return (-1);
}
@@ -383,6 +393,6 @@ strioctl(int fd, int cmd, int len, char *dp)
static void
pcap_stream_err(const char *func, int err, char *errbuf)
{
- pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", func, pcap_strerror(err));
+ pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, err, "%s", func);
}
#endif