netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ordex@autistici.org
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	lindner_marek@yahoo.de
Subject: Re: [PATCH 03/11] batman-adv: randomize initial seqno to avoid collision
Date: Tue, 17 Apr 2012 22:45:27 -0400 (EDT)	[thread overview]
Message-ID: <20120417.224527.288514574622832184.davem@davemloft.net> (raw)
In-Reply-To: <1334663907-22725-4-git-send-email-ordex@autistici.org>

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!

  reply	other threads:[~2012-04-18  2:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17 11:58 pull request: batman-adv 2012-04-17 Antonio Quartulli
2012-04-17 11:58 ` [PATCH 01/11] batman-adv: move ogm initialization into the proper function Antonio Quartulli
2012-04-17 11:58 ` [PATCH 02/11] batman-adv: refactoring API: find generalized name for bat_ogm_init callback Antonio Quartulli
2012-04-17 11:58 ` [PATCH 03/11] batman-adv: randomize initial seqno to avoid collision Antonio Quartulli
2012-04-18  2:45   ` David Miller [this message]
     [not found]     ` <20120417.224527.288514574622832184.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-04-18  6:42       ` Antonio Quartulli
2012-04-17 11:58 ` [PATCH 04/11] batman-adv: add iface_disable() callback to routing API Antonio Quartulli
2012-04-17 11:58 ` [PATCH 05/11] batman-adv: handle routing code initialization properly Antonio Quartulli
     [not found]   ` <1334663907-22725-6-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
2012-04-18  2:46     ` David Miller
     [not found]       ` <20120417.224630.1104076946118354940.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-04-18  6:45         ` Antonio Quartulli
2012-04-17 11:58 ` [PATCH 06/11] batman-adv: refactoring API: find generalized name for bat_ogm_init_primary callback Antonio Quartulli
2012-04-17 11:58 ` [PATCH 07/11] batman-adv: rename BATMAN_OGM_LEN to BATMAN_OGM_HLEN Antonio Quartulli
2012-04-17 11:58 ` [PATCH 08/11] batman-adv: mark existing ogm variables as batman iv Antonio Quartulli
2012-04-17 11:58 ` [PATCH 09/11] batman-adv: use ETH_HLEN instead of sizeof(struct ethhdr) Antonio Quartulli
2012-04-17 11:58 ` [PATCH 10/11] batman-adv: print OGM seq numbers as unsigned long Antonio Quartulli
     [not found]   ` <1334663907-22725-11-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
2012-04-18  2:47     ` David Miller
2012-04-18  6:47       ` Antonio Quartulli
     [not found]         ` <20120418064659.GC27966-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>
2012-04-18  7:01           ` Antonio Quartulli
     [not found]             ` <20120418070134.GD27966-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>
2012-04-18  7:24               ` Antonio Quartulli
2012-04-18  7:28               ` David Miller
2012-04-17 11:58 ` [PATCH 11/11] batman-adv: skip the window protection test when the originator has no neighbours 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=20120417.224527.288514574622832184.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --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).