From 1c1816f670c9015ba97fa6b9780355c787920d67 Mon Sep 17 00:00:00 2001 From: Felix Obenhuber Date: Tue, 29 Dec 2009 01:04:20 -0800 Subject: Add support for CANbus capture. Signed-off-by: Guy Harris --- pcap-linux.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'pcap-linux.c') 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 */ -- cgit v1.2.3