From patchwork Tue Feb 7 09:20:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1502 Return-Path: Received: from nm18-vm0.bullet.mail.ukl.yahoo.com (nm18-vm0.bullet.mail.ukl.yahoo.com [217.146.183.95]) by open-mesh.org (Postfix) with SMTP id 48F22600872 for ; Tue, 7 Feb 2012 10:21:07 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.209] by nm18.bullet.mail.ukl.yahoo.com with NNFMP; 07 Feb 2012 09:21:07 -0000 Received: from [77.238.184.67] by tm2.bullet.mail.ukl.yahoo.com with NNFMP; 07 Feb 2012 09:21:07 -0000 Received: from [127.0.0.1] by smtp136.mail.ukl.yahoo.com with NNFMP; 07 Feb 2012 09:21:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1328606467; bh=obLmuwxqD8WUC6/TdOfPOTA8x5p6gd7bCQFThhvcBO8=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=MmYBfI2xTpE5zU3XbPQwu7dfhqOp8O363CMuK0mrLxekKfTgUfBWGlzXDoD4NoOWUR7nonobZ6QAxgVDUnUcDkwPe39aDiL2WGHWN7Q6aJwko8vfKC2xPm7lYrvt3/Lv5ICSQAW03cAKn05UGhNpKJeB2o5h48qDgkLxIAwDoxY= X-Yahoo-Newman-Id: 134874.10467.bm@smtp136.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: u6xgolgVM1ls3IElA44FGIySm0ZWlnKPi1yb2J7lFITpiKv c5GO.HgM.AgVgAl4eUJf4d2IKmdy.EvXG1wWcoM4krQoGEKXXRYNgUxxJd_1 ZAjvWhmt_SuZUWERjcUDcOb61HiX0Ha_A1kPcEjmVvXyfiIAcsWt7058VjtP OulJpjSqBQSQrkAqv23YFDUtJuhMyM0xkq.6Piy8Ho7.8y1eZ.gtjDKB0jnO v0xteV3V6kpUuTLkF2qDPwuHSuAOeHoQOWbBPcg9rNbzgm3GMx40B6lmp0mz E2W4Xn_VY5vRkGVHkXwqs6GkV73f.8RAX7ENy9Cb5TJmhJgrdozCjFswKeGz F51ZDZtPgPFx_xSUVq1HASk9QWbMm22lxsZb93Q_i6Huqk.bV.vfQBQ2MYPl oRA-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@210.177.7.38 with plain) by smtp136.mail.ukl.yahoo.com with SMTP; 07 Feb 2012 09:21:06 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 7 Feb 2012 17:20:46 +0800 Message-Id: <1328606451-3418-2-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1328606451-3418-1-git-send-email-lindner_marek@yahoo.de> References: <201202071719.22804.lindner_marek@yahoo.de> <1328606451-3418-1-git-send-email-lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 3/8] batman-adv: randomize initial seqno to avoid collision X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2012 09:21:07 -0000 Signed-off-by: Marek Lindner --- bat_iv_ogm.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c index 3eff7f0..4ac2d1d 100644 --- a/bat_iv_ogm.c +++ b/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; + 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); hard_iface->packet_len = BATMAN_OGM_LEN; hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC);