multicast data management fix - previous fix was incorrect. jinmei@kame
This commit is contained in:
parent
75665927eb
commit
0f18c4c945
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: in6.c,v 1.88 2004/06/14 08:07:29 itojun Exp $ */
|
||||
/* $NetBSD: in6.c,v 1.89 2004/06/16 03:17:26 itojun Exp $ */
|
||||
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -62,7 +62,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.88 2004/06/14 08:07:29 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.89 2004/06/16 03:17:26 itojun Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
@ -805,7 +805,6 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
struct in6_ifaddr *oia;
|
||||
struct sockaddr_in6 dst6;
|
||||
struct in6_addrlifetime *lt;
|
||||
struct in6_multi *in6m;
|
||||
struct in6_multi_mship *imm;
|
||||
struct rtentry *rt;
|
||||
|
||||
@ -1055,47 +1054,47 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
if (hostIsNew && in6if_do_dad(ifp))
|
||||
ia->ia6_flags |= IN6_IFF_TENTATIVE;
|
||||
|
||||
/*
|
||||
* We are done if we have simply modified an existing address.
|
||||
*/
|
||||
if (!hostIsNew)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
* Beyond this point, we should call in6_purgeaddr upon an error,
|
||||
* not just go to unlink.
|
||||
*/
|
||||
|
||||
/* join necessary multiast groups */
|
||||
if ((ifp->if_flags & IFF_MULTICAST) != 0) {
|
||||
struct sockaddr_in6 mltaddr, mltmask;
|
||||
#ifndef SCOPEDROUTING
|
||||
u_int32_t zoneid = 0;
|
||||
#endif
|
||||
|
||||
if (hostIsNew) {
|
||||
/* join solicited multicast addr for new host id */
|
||||
struct sockaddr_in6 llsol;
|
||||
/* join solicited multicast addr for new host id */
|
||||
struct sockaddr_in6 llsol;
|
||||
|
||||
bzero(&llsol, sizeof(llsol));
|
||||
llsol.sin6_family = AF_INET6;
|
||||
llsol.sin6_len = sizeof(llsol);
|
||||
llsol.sin6_addr.s6_addr16[0] = htons(0xff02);
|
||||
llsol.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
|
||||
llsol.sin6_addr.s6_addr32[1] = 0;
|
||||
llsol.sin6_addr.s6_addr32[2] = htonl(1);
|
||||
llsol.sin6_addr.s6_addr32[3] =
|
||||
ifra->ifra_addr.sin6_addr.s6_addr32[3];
|
||||
llsol.sin6_addr.s6_addr8[12] = 0xff;
|
||||
IN6_LOOKUP_MULTI(llsol.sin6_addr, ifp, in6m);
|
||||
if (!in6m) {
|
||||
imm = in6_joingroup(ifp, &llsol.sin6_addr,
|
||||
&error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_ERR,
|
||||
"in6_update_ifa: addmulti "
|
||||
"failed for %s on %s (errno=%d)\n",
|
||||
ip6_sprintf(&llsol.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
goto cleanup;
|
||||
}
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships,
|
||||
imm, i6mm_chain);
|
||||
}
|
||||
bzero(&llsol, sizeof(llsol));
|
||||
llsol.sin6_family = AF_INET6;
|
||||
llsol.sin6_len = sizeof(llsol);
|
||||
llsol.sin6_addr.s6_addr16[0] = htons(0xff02);
|
||||
llsol.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
|
||||
llsol.sin6_addr.s6_addr32[1] = 0;
|
||||
llsol.sin6_addr.s6_addr32[2] = htonl(1);
|
||||
llsol.sin6_addr.s6_addr32[3] =
|
||||
ifra->ifra_addr.sin6_addr.s6_addr32[3];
|
||||
llsol.sin6_addr.s6_addr8[12] = 0xff;
|
||||
imm = in6_joingroup(ifp, &llsol.sin6_addr, &error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_ERR,
|
||||
"in6_update_ifa: addmulti "
|
||||
"failed for %s on %s (errno=%d)\n",
|
||||
ip6_sprintf(&llsol.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
goto cleanup;
|
||||
}
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
|
||||
|
||||
bzero(&mltmask, sizeof(mltmask));
|
||||
mltmask.sin6_len = sizeof(struct sockaddr_in6);
|
||||
@ -1152,40 +1151,31 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
#ifndef SCOPEDROUTING
|
||||
mltaddr.sin6_scope_id = zoneid; /* XXX */
|
||||
#endif
|
||||
IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m);
|
||||
if (!in6m) {
|
||||
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_WARNING,
|
||||
"in6_update_ifa: addmulti failed for "
|
||||
"%s on %s (errno=%d)\n",
|
||||
ip6_sprintf(&mltaddr.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
goto cleanup;
|
||||
}
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships, imm,
|
||||
i6mm_chain);
|
||||
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_WARNING,
|
||||
"in6_update_ifa: addmulti failed for "
|
||||
"%s on %s (errno=%d)\n",
|
||||
ip6_sprintf(&mltaddr.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
goto cleanup;
|
||||
}
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
|
||||
|
||||
/*
|
||||
* join node information group address
|
||||
*/
|
||||
if (in6_nigroup(ifp, hostname, hostnamelen, &mltaddr) == 0) {
|
||||
IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m);
|
||||
if (!in6m) {
|
||||
imm = in6_joingroup(ifp, &mltaddr.sin6_addr,
|
||||
&error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_WARNING, "in6_update_ifa: "
|
||||
"addmulti failed for %s on %s "
|
||||
"(errno=%d)\n",
|
||||
ip6_sprintf(&mltaddr.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
/* XXX not very fatal, go on... */
|
||||
} else {
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships,
|
||||
imm, i6mm_chain);
|
||||
}
|
||||
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_WARNING, "in6_update_ifa: "
|
||||
"addmulti failed for %s on %s (errno=%d)\n",
|
||||
ip6_sprintf(&mltaddr.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
/* XXX not very fatal, go on... */
|
||||
} else {
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships,
|
||||
imm, i6mm_chain);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1225,21 +1215,15 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
} else {
|
||||
RTFREE(rt);
|
||||
}
|
||||
IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m);
|
||||
if (!in6m) {
|
||||
imm = in6_joingroup(ifp, &mltaddr.sin6_addr,
|
||||
&error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_WARNING, "in6_update_ifa: "
|
||||
"addmulti failed for %s on %s "
|
||||
"(errno=%d)\n",
|
||||
ip6_sprintf(&mltaddr.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
goto cleanup;
|
||||
}
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships,
|
||||
imm, i6mm_chain);
|
||||
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error);
|
||||
if (!imm) {
|
||||
nd6log((LOG_WARNING, "in6_update_ifa: "
|
||||
"addmulti failed for %s on %s (errno=%d)\n",
|
||||
ip6_sprintf(&mltaddr.sin6_addr),
|
||||
if_name(ifp), error));
|
||||
goto cleanup;
|
||||
}
|
||||
LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user