summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/pcap-linux.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2012-10-05 18:42:50 +0000
committerdelphij <delphij@FreeBSD.org>2012-10-05 18:42:50 +0000
commita130b811b9a9a99ca8b02c74857b7fa5be4a6e2a (patch)
tree8be204ab523349d7c0ed42856fee7a1e630b1c2b /contrib/libpcap/pcap-linux.c
parent29b9cf1535a8a73d0b442723dcf36c041ca9c004 (diff)
parent506bfc5bcf433e44fd03bc0fd0cea5e1ec994d1d (diff)
downloadFreeBSD-src-a130b811b9a9a99ca8b02c74857b7fa5be4a6e2a.zip
FreeBSD-src-a130b811b9a9a99ca8b02c74857b7fa5be4a6e2a.tar.gz
MFV: libpcap 1.3.0.
MFC after: 4 weeks
Diffstat (limited to 'contrib/libpcap/pcap-linux.c')
-rw-r--r--contrib/libpcap/pcap-linux.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/contrib/libpcap/pcap-linux.c b/contrib/libpcap/pcap-linux.c
index d4f50b7..8168e47 100644
--- a/contrib/libpcap/pcap-linux.c
+++ b/contrib/libpcap/pcap-linux.c
@@ -166,6 +166,10 @@ static const char rcsid[] _U_ =
#include "pcap-can-linux.h"
#endif
+#if PCAP_SUPPORT_CANUSB
+#include "pcap-canusb-linux.h"
+#endif
+
#ifdef PCAP_SUPPORT_NETFILTER
#include "pcap-netfilter-linux.h"
#endif
@@ -418,8 +422,15 @@ pcap_create(const char *device, char *ebuf)
}
#endif
+#if PCAP_SUPPORT_CANUSB
+ if (strstr(device, "canusb")) {
+ return canusb_create(device, ebuf);
+ }
+#endif
+
#ifdef PCAP_SUPPORT_CAN
- if (strstr(device, "can") || strstr(device, "vcan")) {
+ if ((strncmp(device, "can", 3) == 0 && isdigit(device[3])) ||
+ (strncmp(device, "vcan", 4) == 0 && isdigit(device[4]))) {
return can_create(device, ebuf);
}
#endif
@@ -2299,6 +2310,11 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf)
return (-1);
#endif
+#if PCAP_SUPPORT_CANUSB
+ if (canusb_platform_finddevs(alldevsp, errbuf) < 0)
+ return (-1);
+#endif
+
return (0);
}
@@ -5403,13 +5419,19 @@ fix_offset(struct bpf_insn *p)
* header.
*/
p->k -= SLL_HDR_LEN;
+ } else if (p->k == 0) {
+ /*
+ * It's the packet type field; map it to the special magic
+ * kernel offset for that field.
+ */
+ p->k = SKF_AD_OFF + SKF_AD_PKTTYPE;
} else if (p->k == 14) {
/*
* It's the protocol field; map it to the special magic
* kernel offset for that field.
*/
p->k = SKF_AD_OFF + SKF_AD_PROTOCOL;
- } else {
+ } else if ((bpf_int32)(p->k) > 0) {
/*
* It's within the header, but it's not one of those
* fields; we can't do that in the kernel, so punt
OpenPOWER on IntegriCloud