Skip to content

Commit

Permalink
batman-adv: randomize initial seqno to avoid collision
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  • Loading branch information
Marek Lindner authored and Antonio Quartulli committed Apr 18, 2012
1 parent c2aca02 commit d7d32ec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d7d32ec

Please sign in to comment.