-/* $OpenBSD: if.c,v 1.310 2015/01/06 21:26:46 stsp Exp $ */
+/* $OpenBSD: if.c,v 1.311 2015/01/10 11:43:37 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
#endif
rt_ifmsg(ifp);
#ifdef INET6
- if (ifp == lo0ifp) /* lo0 is special - needs ::1 */
- in6_if_up(ifp);
+ /* Userland expects the kernel to set ::1 on lo0. */
+ if (ifp == lo0ifp)
+ in6_ifattach(ifp);
#endif
#ifndef SMALL_KERNEL
rt_if_track(ifp);
s = splsoftnet();
if (cmd == SIOCIFAFATTACH) {
if (in6ifa_ifpforlinklocal(ifp, 0) == NULL)
- in6_if_up(ifp);
+ in6_ifattach(ifp);
} else
in6_ifdetach(ifp);
splx(s);
if (ISSET(ifr->ifr_flags, IFXF_AUTOCONF6)) {
if (in6ifa_ifpforlinklocal(ifp, 0) == NULL) {
s = splnet();
- in6_if_up(ifp);
+ in6_ifattach(ifp);
splx(s);
}
}
-/* $OpenBSD: in6.c,v 1.148 2015/01/06 21:26:46 stsp Exp $ */
+/* $OpenBSD: in6.c,v 1.149 2015/01/10 11:43:37 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
*/
s = splsoftnet();
if (in6ifa_ifpforlinklocal(ifp, 0) == NULL)
- in6_if_up(ifp);
+ in6_ifattach(ifp);
error = in6_update_ifa(ifp, ifra, ia6);
splx(s);
if (error != 0)
return (ia6_best);
}
-/*
- * perform DAD when interface becomes IFF_UP.
- */
-void
-in6_if_up(struct ifnet *ifp)
-{
- struct ifaddr *ifa;
- struct in6_ifaddr *ia6;
- int dad_delay; /* delay ticks before DAD output */
-
- /*
- * special cases, like 6to4, are handled in in6_ifattach
- */
- in6_ifattach(ifp);
-
- dad_delay = 0;
- TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
- if (ifa->ifa_addr->sa_family != AF_INET6)
- continue;
- ia6 = ifatoia6(ifa);
- if (ia6->ia6_flags & IN6_IFF_TENTATIVE)
- nd6_dad_start(ifa, &dad_delay);
- }
-
- if (ifp->if_xflags & IFXF_AUTOCONF6)
- nd6_rs_output_set_timo(ND6_RS_OUTPUT_QUICK_INTERVAL);
-}
-
int
in6if_do_dad(struct ifnet *ifp)
{
-/* $OpenBSD: in6.h,v 1.77 2014/12/05 15:50:04 mpi Exp $ */
+/* $OpenBSD: in6.h,v 1.78 2015/01/10 11:43:37 mpi Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
int in6_localaddr(struct in6_addr *);
int in6_addrscope(struct in6_addr *);
struct in6_ifaddr *in6_ifawithscope(struct ifnet *, struct in6_addr *, u_int);
-void in6_if_up(struct ifnet *);
void in6_get_rand_ifid(struct ifnet *, struct in6_addr *);
int in6_mask2len(struct in6_addr *, u_char *);
-/* $OpenBSD: in6_ifattach.c,v 1.80 2015/01/08 17:21:01 florian Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.81 2015/01/10 11:43:37 mpi Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
/*
* Do not let in6_update_ifa() do DAD, since we need a random delay
* before sending an NS at the first time the interface becomes up.
- * Instead, in6_if_up() will start DAD with a proper random delay.
*/
ifra.ifra_flags |= IN6_IFF_NODAD;
}
/*
- * Adjust ia6_flags so that in6_if_up will perform DAD.
+ * Adjust ia6_flags so that in6_ifattach() will perform DAD.
* XXX: Some P2P interfaces seem not to send packets just after
* becoming up, so we skip p2p interfaces for safety.
*/
void
in6_ifattach(struct ifnet *ifp)
{
+ struct ifaddr *ifa;
struct in6_ifaddr *ia6;
- struct in6_addr in6;
+ int dad_delay; /* delay ticks before DAD output */
/* some of the interfaces are inherently not IPv6 capable */
switch (ifp->if_type) {
* XXX multiple loopback interface case.
*/
if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
- in6 = in6addr_loopback;
+ struct in6_addr in6 = in6addr_loopback;
if (in6ifa_ifpwithaddr(ifp, &in6) == NULL) {
if (in6_ifattach_loopback(ifp) != 0)
return;
}
}
}
+
+ /*
+ * perform DAD.
+ */
+ dad_delay = 0;
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
+ if (ifa->ifa_addr->sa_family != AF_INET6)
+ continue;
+ ia6 = ifatoia6(ifa);
+ if (ia6->ia6_flags & IN6_IFF_TENTATIVE)
+ nd6_dad_start(ifa, &dad_delay);
+ }
+
+ if (ifp->if_xflags & IFXF_AUTOCONF6)
+ nd6_rs_output_set_timo(ND6_RS_OUTPUT_QUICK_INTERVAL);
}
/*