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 --]
next prev parent reply other threads:[~2012-04-18 6:42 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
[not found] ` <20120417.224527.288514574622832184.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-04-18 6:42 ` Antonio Quartulli [this message]
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=20120418064202.GA27966@ritirata.org \
--to=ordex-gaufno9rbhfsroww+9zijq@public.gmane.org \
--cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=lindner_marek-LWAfsSFWpa4@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).