netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simone Piunno <pioppo@ferrara.linux.it>
To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" <yoshfuji@linux-ipv6.org>
Cc: davem@redhat.com, kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com,
	linux-kernel@vger.kernel.org, usagi@linux-ipv6.org
Subject: Re: [PATCH] IPv6: Don't assign a same IPv6 address on a same interface (is Re: IPv6 duplicate address bugfix)
Date: Sun, 30 Mar 2003 18:36:56 +0200	[thread overview]
Message-ID: <20030330163656.GA18645@ferrara.linux.it> (raw)
In-Reply-To: <20030330.235809.70243437.yoshfuji@linux-ipv6.org>

On Sun, Mar 30, 2003 at 11:58:09PM +0900, YOSHIFUJI Hideaki wrote:

> > And, patch does not seem optimal. I'd take a look at very soon.
> 
> Here's our patch based on our fix in August, 2001.
> Question: should we use spin_lock_bh() instead of spin_lock()?

Because everywhere else in the file {read,write}_lock_bh() is used 
instead of {read,write}_lock(), so I'm assuming that _bh is required 
but I really don't know why.

Anyway I have some critics over your patch: 

 - locking inside ipv6_add_addr() is simpler and more linear but
   semantically wrong because you're unable to tell the user why his 
   "ip addr add" failed.  E.g. you answer ENOBUFS instead of EEXIST.

 - your ipv6_chk_same_addr() does a useless check for (dev != NULL)

   > +static
   > +int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev)
   > +{
   > +	struct inet6_ifaddr * ifp;
   > +	u8 hash = ipv6_addr_hash(addr);
   > +
   > +	read_lock_bh(&addrconf_hash_lock);
   > +	for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) {
   > +		if (ipv6_addr_cmp(&ifp->addr, addr) == 0) {
   > +			if (dev != NULL && ifp->idev->dev == dev)
   >  				break;
   >  		}

   your never "break" if dev == NULL, so you could return 0 before
   even acquiring the lock.

Regards,
  Simone

-- 
 Simone Piunno -- http://members.ferrara.linux.it/pioppo 
.-------  Adde parvum parvo magnus acervus erit  -------.
 Ferrara Linux Users Group - http://www.ferrara.linux.it 
 Deep Space 6, IPv6 on Linux - http://www.deepspace6.net 
 GNU Mailman, Mailing List Manager - http://www.list.org 
`-------------------------------------------------------'

  reply	other threads:[~2003-03-30 16:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-30 12:27 IPv6 duplicate address bugfix Simone Piunno
2003-03-30 13:08 ` (usagi-users 02296) " YOSHIFUJI Hideaki / 吉藤英明
2003-03-30 14:58   ` [PATCH] IPv6: Don't assign a same IPv6 address on a same interface (is Re: IPv6 duplicate address bugfix) YOSHIFUJI Hideaki / 吉藤英明
2003-03-30 16:36     ` Simone Piunno [this message]
2003-03-30 18:35       ` YOSHIFUJI Hideaki / 吉藤英明
2003-03-31  1:34         ` [PATCH] IPv6: Don't assign a same IPv6 address on a same interface YOSHIFUJI Hideaki / 吉藤英明
2003-03-31 19:05           ` David S. Miller
2003-03-31 18:23 ` (usagi-users 02296) IPv6 duplicate address bugfix Peter Bieringer
2003-03-31 18:56   ` [ds6-devel] " Simone Piunno

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=20030330163656.GA18645@ferrara.linux.it \
    --to=pioppo@ferrara.linux.it \
    --cc=davem@redhat.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=usagi@linux-ipv6.org \
    --cc=yoshfuji@linux-ipv6.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).