FreeBSD/sys/netinet6/in6_ifattach.c
/*
 * XXX multiple loopback interface needs more care.  for instance,
 * nodelocal address needs to be configured onto only one of them.
 * XXX multiple link-local address case
 *
 * altifp - secondary EUI64 source
 */
XXX multiple loopback interface needs more care.  for instance,
nodelocal address needs to be configured onto only one of them.
XXX multiple link-local address case

secondary EUI64 source
XXX multiple loopback interface needs more care . for instance nodelocal address needs to be configured onto only one of them . XXX multiple link - local address case secondary EUI64 source
void
in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
{
	struct in6_ifaddr *ia;
	struct in6_addr in6;
	if (ifp->if_afdata[AF_INET6] == NULL)
		return;
	switch (ifp->if_type) {
	case IFT_STF:
		ND_IFINFO(ifp)->flags &= ~ND6_IFF_AUTO_LINKLOCAL;
		break;
	default:
		break;
	}
	if ((ifp->if_flags & IFF_MULTICAST) == 0) {
		nd6log((LOG_INFO, "in6_ifattach: "
		    "%s is not multicast capable, IPv6 not enabled\n",
		    if_name(ifp)));
		return;
	}
	if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
		struct ifaddr *ifa;
		in6 = in6addr_loopback;
		ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &in6);
		if (ifa == NULL) {
			if (in6_ifattach_loopback(ifp) != 0)
				return;
		} else
			ifa_free(ifa);
	}
	if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
	    ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
		int error;
		ia = in6ifa_ifpforlinklocal(ifp, 0);
		if (ia == NULL) {
			error = in6_ifattach_linklocal(ifp, altifp);
#if 0
			if (error)
				log(LOG_NOTICE, "in6_ifattach_linklocal: "
				    "failed to add a link-local addr to %s\n",
				    if_name(ifp));
#endif
		} else
			ifa_free(&ia->ia_ifa);
	}
	if (V_in6_maxmtu < ifp->if_mtu)
		V_in6_maxmtu = ifp->if_mtu;
}
void in6_ifattach ( struct ifnet * ifp , struct ifnet * altifp ) { struct in6_ifaddr * ia ; struct in6_addr in6 ; if ( ifp -> if_afdata [ AF_INET6 ] == NULL ) return ; switch ( ifp -> if_type ) { case IFT_STF : ND_IFINFO ( ifp ) -> flags &= ~ ND6_IFF_AUTO_LINKLOCAL ; break ; default : break ; } if ( ( ifp -> if_flags & IFF_MULTICAST ) == 0 ) { nd6log ( ( LOG_INFO , " " " \n " , if_name ( ifp ) ) ) ; return ; } if ( ( ifp -> if_flags & IFF_LOOPBACK ) != 0 ) { struct ifaddr * ifa ; in6 = in6addr_loopback ; ifa = ( struct ifaddr * ) in6ifa_ifpwithaddr ( ifp , & in6 ) ; if ( ifa == NULL ) { if ( in6_ifattach_loopback ( ifp ) != 0 ) return ; } else ifa_free ( ifa ) ; } if ( ! ( ND_IFINFO ( ifp ) -> flags & ND6_IFF_IFDISABLED ) && ND_IFINFO ( ifp ) -> flags & ND6_IFF_AUTO_LINKLOCAL ) { int error ; ia = in6ifa_ifpforlinklocal ( ifp , 0 ) ; if ( ia == NULL ) { error = in6_ifattach_linklocal ( ifp , altifp ) ; #if 0 if ( error ) log ( LOG_NOTICE , " " " \n " , if_name ( ifp ) ) ; #endif } else ifa_free ( & ia -> ia_ifa ) ; } if ( V_in6_maxmtu < ifp -> if_mtu ) V_in6_maxmtu = ifp -> if_mtu ; }
XXX multiple loopback interface needs more care.
XXX multiple loopback interface needs more care .
/*
	 * quirks based on interface type
	 */ /*
		 * 6to4 interface is a very special kind of beast.
		 * no multicast, no linklocal.  RFC2529 specifies how to make
		 * linklocals for 6to4 interface, but there's no use and
		 * it is rather harmful to have one.
		 */ /*
	 * usually, we require multicast capability to the interface
	 */ /*
	 * assign loopback address for loopback interface.
	 * XXX multiple loopback interface case.
	 */ /*
	 * assign a link-local address, if there's none.
	 */ /* update dynamically. */