diff options
author | Xin LI <delphij@FreeBSD.org> | 2012-10-05 18:42:50 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2012-10-05 18:42:50 +0000 |
commit | 15752fa8582f3f77b0504f977b08378b93c4c8a7 (patch) | |
tree | 8be204ab523349d7c0ed42856fee7a1e630b1c2b /contrib/libpcap/pcap-linux.c | |
parent | 93a2fe45a627ac7d0c63763b8ac7ddabab270b11 (diff) | |
parent | 3ca61f8b14e648b24f10072d662c12fb35fc4b44 (diff) | |
download | src-15752fa8582f3f77b0504f977b08378b93c4c8a7.tar.gz src-15752fa8582f3f77b0504f977b08378b93c4c8a7.zip |
MFV: libpcap 1.3.0.
MFC after: 4 weeks
Notes
Notes:
svn path=/head/; revision=241231
Diffstat (limited to 'contrib/libpcap/pcap-linux.c')
-rw-r--r-- | contrib/libpcap/pcap-linux.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/contrib/libpcap/pcap-linux.c b/contrib/libpcap/pcap-linux.c index d4f50b7d16e3..8168e474778d 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 |