* 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 */
| 672 | * altifp - secondary EUI64 source |
| 673 | */ |
| 674 | void |
| 675 | in6_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); |
no test coverage detected