netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: f6bvp@free.fr
Cc: ralf@linux-mips.org, linux-hams@vger.kernel.org,
	netdev@vger.kernel.org, bpidoux@free.fr
Subject: Re: [PATCH] [ROSE] rose node number was never decreased
Date: Thu, 26 Aug 2010 16:09:57 -0700 (PDT)	[thread overview]
Message-ID: <20100826.160957.212699485.davem@davemloft.net> (raw)
In-Reply-To: <4C76E765.9020201@free.fr>

From: Bernard F6BVP <f6bvp@free.fr>
Date: Fri, 27 Aug 2010 00:15:01 +0200

> When a ROSE node was deleted, node number was not
> decremented and addr kept going up when a new node
> was added.
> 
> /proc/net/rose_neigh
> addr  callsign  dev  count use mode restart  t0  tf digipeaters
> 00007 F5KBW-9   ax0      1   0  DTE      no   0   0
> 00006 F6BVP-11  ax0      2   0  DTE      no   0   0
> 00005 F6BVP-9   ax0      2   0  DTE      no   0   0
> 00001 RSLOOP-0  ???      0   0  DCE     yes   0   0
> 
> With this patch, rose node number is correctly decreased
> when nodes are deleted and new ones added :
> 
> /proc/net/rose_neigh
> addr  callsign  dev  count use mode restart  t0  tf digipeaters
> 00004 F5KBW-9   ax0      1   0  DTE      no   0   0
> 00003 F6BVP-11  ax0      2   0  DTE      no   0   0
> 00002 F6BVP-9   ax0      2   0  DTE      no   0   0
> 00001 RSLOOP-0  ???      0   0  DCE     yes   0   0
> 
> Signed-off-by: Bernard Pidoux <f6bvp@free.fr>

I don't see how this patch is correct.

The whole point of the rose_neigh_no seems to be to make sure
that unique numbers are given to the neighbours.

But with your patch, we can end up easily with neighbours assigned the
same number.  Consider adding 3 nodes, and let's say they get
rose_neigh_no 1, 2, and 3

A: neigh_no 1
B: neigh_no 2
C: neigh_no 3

Delete B, now rose_neigh_no with your patch applied will be '3'.
Next, add D, which will get neigh_no of '3' which is the same
as what C has.

This can't be right.

What the code wants is an allocation of unique IDs and a simple
bitmap along with find_next_zero_bit(), set_bit(), and clear_bit()
ought to do the trick.


      reply	other threads:[~2010-08-26 23:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26 22:15 [PATCH] [ROSE] rose node number was never decreased Bernard F6BVP
2010-08-26 23:09 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100826.160957.212699485.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=bpidoux@free.fr \
    --cc=f6bvp@free.fr \
    --cc=linux-hams@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).