dect
/
libpcap
Archived
13
0
Fork 0

Add DLT_CAN_SOCKETCAN, for capturing on the Controller Area Network with

Linux SocketCAN.
This commit is contained in:
Guy Harris 2009-10-11 10:16:21 -07:00
parent 8c4dcba6d2
commit 86ed15cc8b
4 changed files with 40 additions and 1 deletions

View File

@ -1559,6 +1559,16 @@ init_linktype(p)
off_nl = -1;
off_nl_nosnap = -1;
return;
case DLT_CAN_SOCKETCAN:
/*
* Currently, only raw "link[N:M]" filtering is supported.
*/
off_linktype = -1;
off_macpl = -1;
off_nl = -1;
off_nl_nosnap = -1;
return;
}
bpf_error("unknown data link type %d", linktype);
/* NOTREACHED */
@ -3420,7 +3430,8 @@ gen_linktype(proto)
bpf_error("Bluetooth link-layer type filtering not implemented");
case DLT_CAN20B:
bpf_error("CAN20B link-layer type filtering not implemented");
case DLT_CAN_SOCKETCAN:
bpf_error("CAN link-layer type filtering not implemented");
case DLT_IEEE802_15_4:
case DLT_IEEE802_15_4_LINUX:

7
pcap.c
View File

@ -657,6 +657,13 @@ static struct dlt_choice dlt_choices[] = {
DLT_CHOICE(DLT_IEEE802_15_4_NONASK_PHY, "IEEE 802.15.4 with non-ASK PHY data"),
DLT_CHOICE(DLT_MPLS, "MPLS with label as link-layer header"),
DLT_CHOICE(DLT_USB_LINUX_MMAPPED, "USB with padded Linux header"),
DLT_CHOICE(DLT_DECT, "DECT"),
DLT_CHOICE(DLT_AOS, "AOS Space Data Link protocol"),
DLT_CHOICE(DLT_WIHART, "Wireless HART"),
DLT_CHOICE(DLT_FC_2, "Fibre Channel FC-2"),
DLT_CHOICE(DLT_FC_2_WITH_FRAME_DELIMS, "Fibre Channel FC-2 with frame delimiters"),
DLT_CHOICE(DLT_IPNET, "Solaris ipnet"),
DLT_CHOICE(DLT_CAN_SOCKETCAN, "CAN-bus with SocketCAN headers"),
DLT_CHOICE_SENTINEL
};

View File

@ -944,6 +944,15 @@ struct bpf_version {
*/
#define DLT_IPNET 226
/*
* CAN (Controller Area Network) frames, with a pseudo-header as supplied
* by Linux SocketCAN. See Documentation/networking/can.txt in the Linux
* source.
*
* Requested by Felix Obenhuber <felix@obenhuber.de>.
*/
#define DLT_CAN_SOCKETCAN 227
/*
* DLT and savefile link type values are split into a class and

View File

@ -784,6 +784,15 @@ static const char rcsid[] _U_ =
*/
#define LINKTYPE_IPNET 226
/*
* CAN (Controller Area Network) frames, with a pseudo-header as supplied
* by Linux SocketCAN. See Documentation/networking/can.txt in the Linux
* source.
*
* Requested by Felix Obenhuber <felix@obenhuber.de>.
*/
#define LINKTYPE_CAN_SOCKETCAN 227
static struct linktype_map {
int dlt;
@ -1123,6 +1132,9 @@ static struct linktype_map {
/* Solaris IPNET */
{ DLT_IPNET, LINKTYPE_IPNET },
/* CAN frames with SocketCAN headers */
{ DLT_CAN_SOCKETCAN, LINKTYPE_CAN_SOCKETCAN },
{ -1, -1 }
};