aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-linux.c
diff options
context:
space:
mode:
authorFelix Obenhuber <felix@obenhuber.de>2009-12-29 01:04:20 -0800
committerGuy Harris <guy@alum.mit.edu>2009-12-29 01:04:20 -0800
commit1c1816f670c9015ba97fa6b9780355c787920d67 (patch)
tree5dda57ddac7e3b746abc1eadf2c994c8a9911828 /pcap-linux.c
parentd32a10c10d72648ae8f25728ac5644e034419c6e (diff)
Add support for CANbus capture.
Signed-off-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 9703040..22339d6 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -176,6 +176,10 @@ static const char rcsid[] _U_ =
#include "pcap-bt-linux.h"
#endif
+#ifdef PCAP_SUPPORT_CAN
+#include "pcap-can-linux.h"
+#endif
+
/*
* If PF_PACKET is defined, we can use {SOCK_RAW,SOCK_DGRAM}/PF_PACKET
* sockets rather than SOCK_PACKET sockets.
@@ -376,6 +380,12 @@ pcap_create(const char *device, char *ebuf)
}
#endif
+#ifdef PCAP_SUPPORT_CAN
+ if (strstr(device, "can") || strstr(device, "vcan")) {
+ return can_create(device, ebuf);
+ }
+#endif
+
#ifdef PCAP_SUPPORT_USB
if (strstr(device, "usbmon")) {
return usb_create(device, ebuf);
@@ -2073,6 +2083,12 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
case ARPHRD_CHAOS:
handle->linktype = DLT_CHAOS;
break;
+#ifndef ARPHRD_CAN
+#define ARPHRD_CAN 280
+#endif
+ case ARPHRD_CAN:
+ handle->linktype = DLT_CAN_SOCKETCAN;
+ break;
#ifndef ARPHRD_IEEE802_TR
#define ARPHRD_IEEE802_TR 800 /* From Linux 2.4 */