batman-adv: randomize initial seqno to avoid collision
authorMarek Lindner <lindner_marek@yahoo.de>
Tue, 7 Feb 2012 09:20:46 +0000 (17:20 +0800)
committerAntonio Quartulli <ordex@autistici.org>
Wed, 18 Apr 2012 07:53:58 +0000 (09:53 +0200)
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
net/batman-adv/bat_iv_ogm.c

index 117b831..95bfc59 100644 (file)
 static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
 {
        struct batman_ogm_packet *batman_ogm_packet;
+       uint32_t random_seqno;
+
+       /* randomize initial seqno to avoid collision */
+       get_random_bytes(&random_seqno, sizeof(random_seqno));
+       atomic_set(&hard_iface->seqno, random_seqno);
 
        hard_iface->packet_len = BATMAN_OGM_LEN;
        hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC);