All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	lindner_marek@yahoo.de
Subject: Re: [B.A.T.M.A.N.] [PATCH 03/11] batman-adv: randomize initial seqno to avoid collision
Date: Wed, 18 Apr 2012 08:42:03 +0200	[thread overview]
Message-ID: <20120418064202.GA27966@ritirata.org> (raw)
In-Reply-To: <20120417.224527.288514574622832184.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

On Tue, Apr 17, 2012 at 10:45:27 -0400, David Miller wrote:
> From: Antonio Quartulli <ordex@autistici.org>
> Date: Tue, 17 Apr 2012 13:58:19 +0200
> 
> > @@ -33,6 +33,11 @@
> >  static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
> >  {
> >  	struct batman_ogm_packet *batman_ogm_packet;
> > +	unsigned long random_seqno;
> > +
> > +	/* randomize initial seqno to avoid collision */
> > +	get_random_bytes(&random_seqno, sizeof(unsigned long));
> > +	atomic_set(&hard_iface->seqno, (uint32_t)random_seqno);
> 
> This is silly.
> 
> Just use "uint32_t" for the type of random_seqno and the sizeof passed
> to get_random_bytes.
> 
> And here comes the magic part.
> 
> Amazing, no ugly and pointless casts needed!

I agree :-)
Thank you for the suggestion.

Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
To: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
	lindner_marek-LWAfsSFWpa4@public.gmane.org
Subject: Re: [PATCH 03/11] batman-adv: randomize initial seqno to avoid collision
Date: Wed, 18 Apr 2012 08:42:03 +0200	[thread overview]
Message-ID: <20120418064202.GA27966@ritirata.org> (raw)
In-Reply-To: <20120417.224527.288514574622832184.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]

On Tue, Apr 17, 2012 at 10:45:27 -0400, David Miller wrote:
> From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> Date: Tue, 17 Apr 2012 13:58:19 +0200
> 
> > @@ -33,6 +33,11 @@
> >  static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
> >  {
> >  	struct batman_ogm_packet *batman_ogm_packet;
> > +	unsigned long random_seqno;
> > +
> > +	/* randomize initial seqno to avoid collision */
> > +	get_random_bytes(&random_seqno, sizeof(unsigned long));
> > +	atomic_set(&hard_iface->seqno, (uint32_t)random_seqno);
> 
> This is silly.
> 
> Just use "uint32_t" for the type of random_seqno and the sizeof passed
> to get_random_bytes.
> 
> And here comes the magic part.
> 
> Amazing, no ugly and pointless casts needed!

I agree :-)
Thank you for the suggestion.

Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2012-04-18  6:42 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17 11:58 [B.A.T.M.A.N.] pull request: batman-adv 2012-04-17 Antonio Quartulli
2012-04-17 11:58 ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 01/11] batman-adv: move ogm initialization into the proper function Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 02/11] batman-adv: refactoring API: find generalized name for bat_ogm_init callback Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 03/11] batman-adv: randomize initial seqno to avoid collision Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-18  2:45   ` [B.A.T.M.A.N.] " David Miller
2012-04-18  2:45     ` David Miller
2012-04-18  6:42     ` Antonio Quartulli [this message]
2012-04-18  6:42       ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 04/11] batman-adv: add iface_disable() callback to routing API Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 05/11] batman-adv: handle routing code initialization properly Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-18  2:46   ` [B.A.T.M.A.N.] " David Miller
2012-04-18  2:46     ` David Miller
2012-04-18  6:45     ` [B.A.T.M.A.N.] " Antonio Quartulli
2012-04-18  6:45       ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 06/11] batman-adv: refactoring API: find generalized name for bat_ogm_init_primary callback Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 07/11] batman-adv: rename BATMAN_OGM_LEN to BATMAN_OGM_HLEN Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 08/11] batman-adv: mark existing ogm variables as batman iv Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 09/11] batman-adv: use ETH_HLEN instead of sizeof(struct ethhdr) Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 10/11] batman-adv: print OGM seq numbers as unsigned long Antonio Quartulli
2012-04-17 11:58   ` Antonio Quartulli
2012-04-18  2:47   ` [B.A.T.M.A.N.] " David Miller
2012-04-18  2:47     ` David Miller
2012-04-18  6:47     ` [B.A.T.M.A.N.] " Antonio Quartulli
2012-04-18  6:47       ` Antonio Quartulli
2012-04-18  7:01       ` [B.A.T.M.A.N.] " Antonio Quartulli
2012-04-18  7:01         ` Antonio Quartulli
2012-04-18  7:24         ` [B.A.T.M.A.N.] " Antonio Quartulli
2012-04-18  7:24           ` Antonio Quartulli
2012-04-18  7:28         ` [B.A.T.M.A.N.] " David Miller
2012-04-18  7:28           ` David Miller
2012-04-17 11:58 ` [B.A.T.M.A.N.] [PATCH 11/11] batman-adv: skip the window protection test when the originator has no neighbours Antonio Quartulli
2012-04-17 11:58   ` 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=20120418064202.GA27966@ritirata.org \
    --to=ordex@autistici.org \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.