linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ico Doornekamp <ico@pruts.nl>
To: linux-can <linux-can@vger.kernel.org>
Subject: Re: CAN libpcap capture endianess
Date: Tue, 10 May 2016 21:25:14 +0200	[thread overview]
Message-ID: <1462908218-sup-6526@pruts.nl> (raw)
In-Reply-To: <1378920814-sup-4559@pruts.nl>

Sorry to resurrect this three your old thread, but it seems that the
issue stil exists, and the source of the problem does not seem to lie in
wireshark, but somewhere in the can-raw handling.

There still seems to be an endianess problem with raw socket access to slcan
devices. The original message from sep 2013 is pasted below this mail.

I have found a simple way to reproduce, this is what I do:

- setup a vcan device 'vcan0'

  modprobe vcan
  ip link add dev vcan0 type vcan
  ip link set vcan0 up 

- setup a slcan device 'slcan0'. You do not need an actual slcan
  interface, it is enough to slattach to any serial device

  slcan_attach -s5 /dev/ttyUSB0
  slcand -o -c -f -s5 ttyUSB0
  ifconfig slcan0 up

- send a CAN frame on vcan0 and observe in wireshark:

  $ cansend vcan0 '123#00000000'

  1 0.000000 -> CAN 12 STD: 0x00000123 00 00 00 00


- send a CAN frame on slcan0 and observe in wireshark:

 $ cansend slcan0 '123#00000000'

 1 0.000000000 -> CAN 16 ERR: 0x03010000 00 00 00 00


The problem resides in the endianess of the CAN ID that is decoded. On vcan0
the proper address is seen (0x00000123), but on slcan0 the address is read in
the wrong order (0x03010000).

I have verified that the CAN message on the bus on slcan0 is actually
sent with ID 0x123. Messages received from other devices are also shown
with wrong endianess.


* On 2013-09-11 19:42:43 +0200, Ico wrote:
 
> Recently I tried the CANopen module in wireshark to sniff on my slcan
> interface, but the dissector seemed to mix up the endianess of the
> capture. The source of the dissector seems to assume the CANopen data is
> encoded in big endian, altough afaik CANopen uses little endian for its
> data.
> 
> I contacted Yegor Yefremov, the contributor of the CANopen dissector,
> who is now just confused as I am: he made some captures on his own
> setup, on which the endianess is indeed different then from mine.
> 
> We both run on x86, so host endianess does not seem to be part of the
> problem.
> 
> Hereby I attach two capture files, one made on my setup, and one made by
> Yegor. Can oneone check which one has the proper endianess, and maybe
> take a look at the current CANopen dissector in wireshark to see if the
> implementation is ok?
> 
> Thank you,
> 
> Ico
> 
> attached:
> 
> 1. capture-ico.pcap: CAN-232 interface, slcan, x86_64
> 2. capture-yegor.pcap: VScom USB-CAN interface, slcal, x86
> 

-- 
:wq
^X^Cy^K^X^C^C^C^C

  parent reply	other threads:[~2016-05-10 19:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 17:42 CAN libpcap capture endianess Ico
2013-09-11 18:22 ` Marc Kleine-Budde
2013-09-11 18:30   ` Ico Doornekamp
2013-09-11 18:38     ` Marc Kleine-Budde
2013-09-11 18:53       ` Ico Doornekamp
2013-09-11 19:22         ` Oliver Hartkopp
2013-09-11 19:17       ` Oliver Hartkopp
2013-09-11 19:34         ` Marc Kleine-Budde
2013-09-11 19:37 ` Marc Kleine-Budde
2013-09-11 20:05   ` Ico Doornekamp
2013-09-11 20:11     ` Marc Kleine-Budde
2013-09-12  6:52       ` Ico Doornekamp
2013-09-12  8:00         ` Marc Kleine-Budde
2013-09-12  8:47           ` Ico Doornekamp
2013-09-12  8:52             ` Marc Kleine-Budde
2013-09-12  9:09               ` Ico Doornekamp
2013-09-12  9:13                 ` Marc Kleine-Budde
2013-09-12  9:31                   ` Ico Doornekamp
2016-05-10 19:25 ` Ico Doornekamp [this message]
2016-05-11  7:40   ` Oliver Hartkopp
     [not found]     ` <1462952665-sup-1016@pruts.nl>
2016-05-11  8:17       ` Oliver Hartkopp
2016-05-11 12:28         ` Ico Doornekamp
2016-05-11 13:25           ` Oliver Hartkopp
2016-05-11 17:01             ` Ico Doornekamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462908218-sup-6526@pruts.nl \
    --to=ico@pruts.nl \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).