summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-08-25 16:58:25 -0700
committerGuy Harris <guy@alum.mit.edu>2016-08-25 23:58:57 +0000
commit17f977ec5695259ec02c7e6e4cd24e3e2ed263c1 (patch)
tree0d5d83cf1c69083d7fdc55b0932aebed5283d926
parent27372ca7379b3ff5cccf1488d96a72d06dfba0d1 (diff)
downloadwireshark-17f977ec5695259ec02c7e6e4cd24e3e2ed263c1.tar.gz
Handle ETH_P_CANFD as well as ETH_P_CAN.
Both of them need to have the CAN ID/flags field of the header byte-swapped as necessary to make sure it's in the *reading* host's byte order, not the *writing* host's byte order, if the two are different. Change-Id: Iac1589fdd9fe4d9ee6fbac8d821b48694d68919b Reviewed-on: https://code.wireshark.org/review/17333 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--wiretap/pcap-common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index 316e1a36c5..27e3fd687f 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -751,6 +751,12 @@ wtap_encap_requires_phdr(int wtap_encap)
#define LINUX_SLL_LEN 16 /* length of the header */
/*
+ * The protocols we have to check for.
+ */
+#define LINUX_SLL_P_CAN 0x000C /* Controller Area Network */
+#define LINUX_SLL_P_CANFD 0x000D /* Controller Area Network flexible data rate */
+
+/*
* The fake link-layer header of IrDA packets as introduced by Jean Tourrilhes
* to libpcap.
*/
@@ -1206,7 +1212,7 @@ pcap_byteswap_linux_sll_pseudoheader(struct wtap_pkthdr *phdr, guint8 *pd)
}
protocol = pntoh16(&pd[LINUX_SLL_PROTOCOL_OFFSET]);
- if (protocol != 0x000C) {
+ if (protocol != LINUX_SLL_P_CAN && protocol != LINUX_SLL_P_CANFD) {
/* Not a CAN packet; nothing to fix */
return;
}