diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-13 04:12:41 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-13 04:12:41 +0000 |
commit | 464f895b71ebd7e349f86c2bc48b6b2391c9450f (patch) | |
tree | 98873f380c90ae34404dfb49e01e53d9b2763606 | |
parent | ed9827101edd87e66647f45db2a21a7cf4861a6a (diff) |
make sure to attach new in6_ifaddr into ifp->if_addrlist.
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2207fb8f6d2..735b15b2bb8 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,10 +1,10 @@ -/* $OpenBSD: nd6_rtr.c,v 1.6 2000/03/02 09:44:28 itojun Exp $ */ -/* $KAME: nd6_rtr.c,v 1.27 2000/02/26 06:53:11 itojun Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.7 2000/06/13 04:12:40 itojun Exp $ */ +/* $KAME: nd6_rtr.c,v 1.40 2000/06/13 03:02:29 jinmei Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -664,7 +664,7 @@ defrtrlist_update(new) /* * Insert the new router at the end of the Default Router List. * If there is no other router, install it anyway. Otherwise, - * just continue to use the current default router. + * just continue to use the current default router. */ TAILQ_INSERT_TAIL(&nd_defrouter, n, dr_entry); if (TAILQ_FIRST(&nd_defrouter) == n) @@ -1235,25 +1235,22 @@ in6_ifadd(ifp, in6, addr, prefixlen) for( ; oia->ia_next; oia = oia->ia_next) continue; oia->ia_next = ia; - } else + } else { + /* + * This should be impossible, since we have at least one + * link-local address (see the beginning of this function). + * XXX: should we rather panic here? + */ + printf("in6_ifadd: in6_ifaddr is NULL (impossible!)\n"); in6_ifaddr = ia; + } + /* gain a refcnt for the link from in6_ifaddr */ ia->ia_ifa.ifa_refcnt++; /* link to if_addrlist */ - if (ifp->if_addrlist.tqh_first != NULL) { - TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, - ifa_list); - ia->ia_ifa.ifa_refcnt++; - } -#if 0 - else { - /* - * this should not be the case because there is at least one - * link-local address(see the beginning of the function). - */ - TAILQ_INIT(&ifp->if_addrlist); - } -#endif + TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list); + /* gain another refcnt for the link from if_addrlist */ + ia->ia_ifa.ifa_refcnt++; /* new address */ ia->ia_addr.sin6_len = sizeof(struct sockaddr_in6); @@ -1465,7 +1462,7 @@ in6_init_address_ltimes(struct nd_prefix *new, /* * Delete all the routing table entries that use the specified gateway. * XXX: this function causes search through all entries of routing table, so - * it shouldn't be called when acting as a router. + * it shouldn't be called when acting as a router. */ void rt6_flush(gateway, ifp) |