[ds6-devel] Multiple IPv6 addresses?
Simone Piunno
pioppo at ferrara.linux.it
Tue Mar 25 21:36:05 CET 2003
On Mon, Mar 24, 2003 at 09:52:06PM -0800, Chad N. Tindel wrote:
> I noticed that if I run the command:
>
> ip addr add fec0:0:0:1::ee3f/64 dev eth0
>
> multiple times, the IP address will show up in ifconfig output multiple
> times. Why wouldn't the SIOCSIFADDR ioctl return EEXIST or something
> similar in this case? It seems like obviously incorrect behavior.
Hi Chad,
I believe you're right. Do you feel like trying this patch?
It's for vanilla 2.4.20
--- net/ipv6/addrconf.c.orig 2003-03-25 21:33:55.000000000 +0100
+++ net/ipv6/addrconf.c 2003-03-25 21:34:08.000000000 +0100
@@ -88,6 +88,7 @@
*/
static struct inet6_ifaddr *inet6_addr_lst[IN6_ADDR_HSIZE];
static rwlock_t addrconf_hash_lock = RW_LOCK_UNLOCKED;
+static rwlock_t addrconf_add_lock = RW_LOCK_UNLOCKED;
/* Protects inet6 devices */
rwlock_t addrconf_lock = RW_LOCK_UNLOCKED;
@@ -1032,12 +1033,20 @@
return -ENOBUFS;
scope = ipv6_addr_scope(pfx);
+
+ read_lock_bh(&addrconf_add_lock);
+ if (!ipv6_chk_addr(pfx, dev)) {
+ read_unlock_bh(&addrconf_add_lock);
+ return -EEXIST;
+ }
if ((ifp = ipv6_add_addr(idev, pfx, plen, scope, IFA_F_PERMANENT)) != NULL) {
+ read_unlock_bh(&addrconf_add_lock);
addrconf_dad_start(ifp);
in6_ifa_put(ifp);
return 0;
}
+ read_unlock_bh(&addrconf_add_lock);
return -ENOBUFS;
}
--
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
`-------------------------------------------------------'
More information about the ds6-devel
mailing list