diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2012-02-07 10:20:46 +0100 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-04-18 09:53:58 +0200 |
commit | d7d32ec0f199cc00a43434cdd920338763fab2e0 (patch) | |
tree | 1973ed9dc19abe00031de274409e1da9016f68fc /net/batman-adv | |
parent | batman-adv: refactoring API: find generalized name for bat_ogm_init callback (diff) | |
download | linux-d7d32ec0f199cc00a43434cdd920338763fab2e0.tar.xz linux-d7d32ec0f199cc00a43434cdd920338763fab2e0.zip |
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.c | 5 |
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); |