MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in6_ifattach

Function in6_ifattach

freebsd/netinet6/in6_ifattach.c:674–742  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

672 * altifp - secondary EUI64 source
673 */
674void
675in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
676{
677 struct in6_ifaddr *ia;
678
679 if (ifp->if_afdata[AF_INET6] == NULL)
680 return;
681 /*
682 * quirks based on interface type
683 */
684 switch (ifp->if_type) {
685 case IFT_STF:
686 /*
687 * 6to4 interface is a very special kind of beast.
688 * no multicast, no linklocal. RFC2529 specifies how to make
689 * linklocals for 6to4 interface, but there's no use and
690 * it is rather harmful to have one.
691 */
692 ND_IFINFO(ifp)->flags &= ~ND6_IFF_AUTO_LINKLOCAL;
693 ND_IFINFO(ifp)->flags |= ND6_IFF_NO_DAD;
694 break;
695 default:
696 break;
697 }
698
699 /*
700 * usually, we require multicast capability to the interface
701 */
702 if ((ifp->if_flags & IFF_MULTICAST) == 0) {
703 nd6log((LOG_INFO, "in6_ifattach: "
704 "%s is not multicast capable, IPv6 not enabled\n",
705 if_name(ifp)));
706 return;
707 }
708
709 /*
710 * assign loopback address for loopback interface.
711 */
712 if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
713 /*
714 * check that loopback address doesn't exist yet.
715 */
716 ia = in6ifa_ifwithaddr(&in6addr_loopback, 0);
717 if (ia == NULL)
718 in6_ifattach_loopback(ifp);
719 else
720 ifa_free(&ia->ia_ifa);
721 }
722
723 /*
724 * assign a link-local address, if there's none.
725 */
726 if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
727 ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
728 struct epoch_tracker et;
729
730 NET_EPOCH_ENTER(et);
731 ia = in6ifa_ifpforlinklocal(ifp, 0);

Callers 2

in6_if_upFunction · 0.85
nd6_ioctlFunction · 0.85

Calls 5

in6ifa_ifwithaddrFunction · 0.85
in6_ifattach_loopbackFunction · 0.85
ifa_freeFunction · 0.85
in6ifa_ifpforlinklocalFunction · 0.85
in6_ifattach_linklocalFunction · 0.85

Tested by

no test coverage detected