Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 multicast data management fix - previous fix wa...
details: https://anonhg.NetBSD.org/src/rev/2f2dc40ad015
branches: trunk
changeset: 567484:2f2dc40ad015
user: itojun <itojun%NetBSD.org@localhost>
date: Wed Jun 16 03:17:26 2004 +0000
description:
multicast data management fix - previous fix was incorrect. jinmei@kame
diffstat:
sys/netinet6/in6.c | 130 +++++++++++++++++++++++-----------------------------
1 files changed, 57 insertions(+), 73 deletions(-)
diffs (191 lines):
diff -r 2d7649d6a765 -r 2f2dc40ad015 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Wed Jun 16 02:41:55 2004 +0000
+++ b/sys/netinet6/in6.c Wed Jun 16 03:17:26 2004 +0000
@@ -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 @@
struct in6_ifaddr *oia;
struct sockaddr_in6 dst6;
struct in6_addrlifetime *lt;
- struct in6_multi *in6m;
struct in6_multi_mship *imm;
struct rtentry *rt;
@@ -1056,46 +1055,46 @@
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 @@
#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 @@
} 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);
}
}
Home |
Main Index |
Thread Index |
Old Index