From: Antonio Quartulli <antonio@meshcoding.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <ordex@autistici.org>,
Marek Lindner <lindner_marek@yahoo.de>
Subject: Re: [PATCH 10/16] batman-adv: use CRC32C instead of CRC16 in TT code
Date: Wed, 9 Oct 2013 16:35:00 +0200 [thread overview]
Message-ID: <20131009143500.GH3544@neomailbox.net> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7384@saturn3.aculab.com>
[-- Attachment #1: Type: text/plain, Size: 2770 bytes --]
On Wed, Oct 09, 2013 at 03:11:08PM +0100, David Laight wrote:
> > CRC32C has to be preferred to CRC16 because of its possible
> > HW native support and because of the reduced collision
> > probability. With this change the Translation Table
> > component now uses CRC32C to compute the local and global
> > table checksum.
> ...
> > -/* Calculates the checksum of the local table of a given orig_node */
> > -static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
> > +/**
> > + * batadv_tt_global_crc - calculates the checksum of the local table belonging
> > + * to the given orig_node
> > + * @bat_priv: the bat priv with all the soft interface information
> > + */
> > +static uint32_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
> > struct batadv_orig_node *orig_node)
> ...
> > for (i = 0; i < hash->size; i++) {
> > head = &hash->table[i];
> > @@ -1435,27 +1437,24 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
> > orig_node))
> > continue;
> >
> ...
> > + crc ^= crc32c(0, tt_common->addr, ETH_ALEN);
> > }
>
> Are you really generating CRC32 of a pile of ethernet MAC addresses
> and the XORing the CRC together?
> That gives the same answer as XORing together the MAC addresses and
> then doing a CRC of the final value.
I was not sure about this since the CRC32 is not a linear operation. However
this routine is not on the fast path, so we can also live with this order.
> So it gives you almost no protection against corruption at all.
The corruption check is for the entire global table.
The global table is the union of the local tables of all the other nodes (each
node has a local and a global table).
The resulting value (the xor of the CRCs) is then compared to the value
sent by whom originated this piece of global table.
In this way each batman-adv node is sure to have the entries that the node
really generated in its local table.
(sorry for using the word table several times..)
Does this clarify? or have I misunderstood your objection?
>
> ...
> > -/* Calculates the checksum of the local table */
> > -static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
> > +/**
> > + * batadv_tt_local_crc - calculates the checksum of the local table
> > + * @bat_priv: the bat priv with all the soft interface information
> > + */
> > +static uint32_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
> > {
> ...
>
> This looks like a clone of the previous routine.
> Surely you can avoid the code duplication.
Some parts are the same, true. But this was already like this.
We can surely try to improve it later on with another patch.
Regards,
--
Antonio Quartulli
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-10-09 14:35 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 12:40 pull request: batman-adv 2013-10-09 Antonio Quartulli
2013-10-09 12:40 ` [PATCH 01/16] MAINTAINERS: batman-adv - update emails Antonio Quartulli
2013-10-09 12:40 ` [PATCH 02/16] batman-adv: switch to a new packet compatibility version Antonio Quartulli
2013-10-09 12:40 ` [PATCH 03/16] batman-adv: tvlv - basic infrastructure Antonio Quartulli
2013-10-09 12:40 ` [PATCH 04/16] batman-adv: tvlv - gateway download/upload bandwidth container Antonio Quartulli
2013-10-09 12:40 ` [PATCH 05/16] batman-adv: tvlv - add distributed arp table container Antonio Quartulli
2013-10-09 12:40 ` [PATCH 06/16] batman-adv: tvlv - add network coding container Antonio Quartulli
2013-10-09 12:40 ` [PATCH 07/16] batman-adv: tvlv - convert tt data sent within OGMs Antonio Quartulli
2013-10-09 12:40 ` [PATCH 08/16] batman-adv: tvlv - convert tt query packet to use tvlv unicast packets Antonio Quartulli
2013-10-09 12:40 ` [PATCH 09/16] batman-adv: tvlv - convert roaming adv " Antonio Quartulli
2013-10-09 12:40 ` [PATCH 10/16] batman-adv: use CRC32C instead of CRC16 in TT code Antonio Quartulli
2013-10-09 14:11 ` David Laight
2013-10-09 14:35 ` Antonio Quartulli [this message]
2013-10-09 15:49 ` David Laight
2013-10-09 16:10 ` Antonio Quartulli
2013-10-09 16:15 ` Antonio Quartulli
2013-10-09 16:19 ` David Laight
2013-10-09 17:05 ` Antonio Quartulli
2013-10-09 12:40 ` [PATCH 11/16] batman-adv: move BATADV_TT_CLIENT_TEMP to higher bit Antonio Quartulli
2013-10-09 12:40 ` [PATCH 12/16] batman-adv: remove vis functionality Antonio Quartulli
2013-10-09 12:40 ` [PATCH 13/16] batman-adv: add build check macros for packet member offset Antonio Quartulli
2013-10-09 12:40 ` [PATCH 14/16] batman-adv: reorder packet types Antonio Quartulli
2013-10-09 12:40 ` [PATCH 15/16] batman-adv: remove packed from batadv_ogm_packet Antonio Quartulli
2013-10-09 12:40 ` [PATCH 16/16] batman-adv: reorder batadv_iv_flags Antonio Quartulli
2013-10-09 17:56 ` pull request: batman-adv 2013-10-09 David Miller
2013-10-09 18:53 ` David Miller
2013-10-09 19:01 ` Antonio Quartulli
-- strict thread matches above, loose matches on Subject: below --
2013-10-09 19:32 pull request: batman-adv 2013-10-09b Antonio Quartulli
2013-10-09 19:32 ` [PATCH 10/16] batman-adv: use CRC32C instead of CRC16 in TT code Antonio Quartulli
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=20131009143500.GH3544@neomailbox.net \
--to=antonio@meshcoding.com \
--cc=David.Laight@ACULAB.COM \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=lindner_marek@yahoo.de \
--cc=netdev@vger.kernel.org \
--cc=ordex@autistici.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).