aboutsummaryrefslogtreecommitdiff
path: root/net/batman-adv
diff options
context:
space:
mode:
authorMarek Lindner2012-02-07 17:20:46 +0800
committerAntonio Quartulli2012-04-18 09:53:58 +0200
commitd7d32ec0f199cc00a43434cdd920338763fab2e0 (patch)
tree1973ed9dc19abe00031de274409e1da9016f68fc /net/batman-adv
parentc2aca02235c014de57b03aa725d9b094f7a87cac (diff)
batman-adv: randomize initial seqno to avoid collision
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bat_iv_ogm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 117b8314e8c7..95bfc5962e1a 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -33,6 +33,11 @@
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);