Message ID | 1328606451-3418-2-git-send-email-lindner_marek@yahoo.de (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | 852b9dcc54d6dc7886c4babe47d8d3f854cd9920 |
Headers |
Return-Path: <lindner_marek@yahoo.de> 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 <b.a.t.m.a.n@lists.open-mesh.org>; 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 <lindner_marek@yahoo.de> 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 <lindner_marek@yahoo.de> 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 <b.a.t.m.a.n@lists.open-mesh.org> List-Id: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n.lists.open-mesh.org> List-Unsubscribe: <https://lists.open-mesh.org/mm/options/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=unsubscribe> List-Archive: <http://lists.open-mesh.org/pipermail/b.a.t.m.a.n> List-Post: <mailto:b.a.t.m.a.n@lists.open-mesh.org> List-Help: <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=help> List-Subscribe: <https://lists.open-mesh.org/mm/listinfo/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=subscribe> X-List-Received-Date: Tue, 07 Feb 2012 09:21:07 -0000 |
Commit Message
Marek Lindner
Feb. 7, 2012, 9:20 a.m. UTC
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
bat_iv_ogm.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
Comments
On 2012-02-07 10:20, Marek Lindner wrote: > Signed-off-by: Marek Lindner<lindner_marek@yahoo.de> > --- > 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); Wouldn't it be better to cast "unsigned long" in the call to atomic_set()?
On Tuesday, February 07, 2012 17:33:14 Martin Hundebøll wrote: > On 2012-02-07 10:20, Marek Lindner wrote: > > Signed-off-by: Marek Lindner<lindner_marek@yahoo.de> > > --- > > > > 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); > > Wouldn't it be better to cast "unsigned long" in the call to atomic_set()? Why should it better ? Regards, Marek
On 2012-02-07 12:10, Marek Lindner wrote: >>> + 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); >> > >> > Wouldn't it be better to cast "unsigned long" in the call to atomic_set()? > Why should it better ? Maybe not better, but at least it is consistent with the type of random_seqno, which is unsigned long. I know the two types are identical, but nevertheless, I like to use the same type of type :)
On Tuesday, February 07, 2012 19:13:27 Martin Hundebøll wrote: > On 2012-02-07 12:10, Marek Lindner wrote: > >>> + 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); > >> > > >> > Wouldn't it be better to cast "unsigned long" in the call to > >> > atomic_set()? > > > > Why should it better ? > > Maybe not better, but at least it is consistent with the type of > random_seqno, which is unsigned long. I know the two types are identical, > but nevertheless, I like to use the same type of type :) You lost me somewhere. Yes, random_seqno is unsigned long. If we wanted to store unsigned long we would not need a cast. However, in my kernel the second argument for atomic_set() is "int" and not "unsigned long" which why we have a cast there. Regards, Marek
On Tue, Feb 07, 2012 at 05:20:46PM +0800, Marek Lindner wrote: > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> > --- > 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); Hi Marek Does this sequence number have any security relevance? Does it make sense to use the TCP sequence number generation code? Andrew
On Tuesday, February 07, 2012 20:12:00 Andrew Lunn wrote: > Does this sequence number have any security relevance? Does it make > sense to use the TCP sequence number generation code? There is no security relevance I know of. The idea was simply to start with random number. Random is a bit better than 1. ;-) Where can I find the TCP sequence number code you are referring to ? Regards, Marek
On Tue, Feb 07, 2012 at 08:21:55PM +0800, Marek Lindner wrote: > On Tuesday, February 07, 2012 20:12:00 Andrew Lunn wrote: > > Does this sequence number have any security relevance? Does it make > > sense to use the TCP sequence number generation code? > > There is no security relevance I know of. The idea was simply to start with > random number. Random is a bit better than 1. ;-) > > Where can I find the TCP sequence number code you are referring to ? I had to go find it, since i've never looked at it before. net/core/secure_seq.c: __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport) but it does not look very re-usable, since it takes all these addresses. What might be usable is: __u32 secure_ip_id(__be32 daddr) { u32 hash[MD5_DIGEST_WORDS]; hash[0] = (__force __u32) daddr; hash[1] = net_secret[13]; hash[2] = net_secret[14]; hash[3] = net_secret[15]; md5_transform(hash, net_secret); return hash[0]; } passing it the last four bytes of the originator MAC address? Andrew
On Tuesday, February 07, 2012 17:20:46 Marek Lindner wrote: > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> > --- > bat_iv_ogm.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) Applied in revision 852b9dc. Regards, Marek
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);