linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ico Doornekamp <can@zevv.nl>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can <linux-can@vger.kernel.org>,
	yegorslists <yegorslists@googlemail.com>
Subject: Re: CAN libpcap capture endianess
Date: Thu, 12 Sep 2013 11:09:46 +0200	[thread overview]
Message-ID: <1378976796-sup-1310@pruts.nl> (raw)
In-Reply-To: <523180D2.700@pengutronix.de>

* On 2013-09-12 10:52:34 +0200, Marc Kleine-Budde wrote:
 
> On 09/12/2013 10:47 AM, Ico Doornekamp wrote:
> > * On 2013-09-12 10:00:10 +0200, Marc Kleine-Budde wrote:
> >  
> >> ...but your CAN frames don't look correct in wireshark. I suggest you
> >> bring up the command line tools and use candump to display the raw CAN
> >> frames. Raw CAN frames, as they enter the application, are in host
> >> order. To be precise the can_id is in host order, as all other members
> >> are u8. "data" is an array of 8 x u8, which is in fact big endian
> >> ordered, if you want to access it with 2x32 or 64 bit.
> >>
> >>> struct can_frame {
> >>>         canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
> >>>         __u8    can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
> >>>         __u8    data[CAN_MAX_DLEN] __attribute__((aligned(8)));
> >>> };
> > 
> > I just did this. candump shows this:
> > 
> >   slcan0  58A   [8]  4B 12 20 04 D6 00 00 00
> > 
> > The raw data is shown in wireshark as
> > 
> >   8a 05 00 00 08 00 00 00  4b 12 20 04 d6 00 00 00
 
> "8a 05 00 00" in little endian is 0x0000058a, "08 00 00 00" is the dlc
> of 8. Looks correct.
> 
> > The CAN dissector parses this as identifier 0x0a050000 with the
> > 'extended' flag set , which seems to have the wrong endianess.
> > 
> > The CANopen dissector also interprets the identifier with wrong endian
> > order, and is thus not able to decode the rest of the packet.
> > 
> > If I'm not mistaking, both the CAN and CANopen dissector in wireshark
> > are thus assuming wrong endianess. I'll check the source and see if I
> > can come up with a proper patch for the wireshark team.
> 
> They are assuming the wrong endianes for your capture file. Yegor's
> capture file, which comes in another format, is interpreted correctly.

Sorry, I was not completely clear on this: I did the capturing on the
slcan0 interface from wireshark, so I did not make a capture file first.

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

  reply	other threads:[~2013-09-12  9:09 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 [this message]
2013-09-12  9:13                 ` Marc Kleine-Budde
2013-09-12  9:31                   ` Ico Doornekamp
2016-05-10 19:25 ` Ico Doornekamp
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=1378976796-sup-1310@pruts.nl \
    --to=can@zevv.nl \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=yegorslists@googlemail.com \
    /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).