Lines Matching defs:ifa
175 struct ifaddr *ifa)
178 if (ifa->ifa_debug & IFA_ATTACHED) {
181 ifaref(ifa);
182 ifa->ifa_debug |= IFA_ATTACHED;
183 TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
189 struct ifaddr *ifa)
194 if ((ifa->ifa_debug & IFA_ATTACHED) == 0) {
195 printf("if_detach_ifa: ifa is not attached to any interface! flags=%lu\n", ifa->ifa_debug);
201 if (ifa2 == ifa)
204 if (ifa2 != ifa) {
209 TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
210 ifa->ifa_debug &= ~IFA_ATTACHED;
211 ifafree(ifa);
525 struct ifaddr *ifa;
532 for (ifa = ifp->if_addrhead.tqh_first; ifa;
533 ifa = ifa->ifa_link.tqe_next) {
534 if (ifa->ifa_addr->sa_family != AF_INET)
536 addr2 = IA_SIN(ifa)->sin_addr.s_addr;
556 struct ifaddr *ifa0 = NULL, *ifa;
559 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
560 if (ifa->ifa_addr->sa_family == family && ifa0 == NULL) {
561 ifa0 = ifa;
581 struct ifaddr *ifa;
590 for (ifa = ifp->if_addrhead.tqh_first; ifa;
591 ifa = ifa->ifa_link.tqe_next) {
592 if (ifa->ifa_addr->sa_family != addr->sa_family)
594 if (equal(addr, ifa->ifa_addr)) {
595 result = ifa;
598 if ((ifp->if_flags & IFF_BROADCAST) && ifa->ifa_broadaddr &&
600 ifa->ifa_broadaddr->sa_len != 0 &&
601 equal(ifa->ifa_broadaddr, addr)) {
602 result = ifa;
623 struct ifaddr *ifa;
630 for (ifa = ifp->if_addrhead.tqh_first; ifa;
631 ifa = ifa->ifa_link.tqe_next) {
632 if (ifa->ifa_addr->sa_family != addr->sa_family)
634 if (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr)) {
635 result = ifa;
668 struct ifaddr *ifa = NULL;
675 for (ifa = ifp->if_addrhead.tqh_first; ifa != NULL;
676 ifa = ifa->ifa_link.tqe_next) {
677 if (ifa->ifa_addr->sa_family != addr->sa_family)
679 if (equal(addr, ifa->ifa_addr)) {
680 result = ifa;
684 ifa->ifa_broadaddr != NULL &&
686 ifa->ifa_broadaddr->sa_len != 0 &&
687 equal(ifa->ifa_broadaddr, addr)) {
688 result = ifa;
721 struct ifaddr *ifa = NULL;
737 ifa = ifnet_addrs[sdl->sdl_index - 1];
739 if (ifa)
740 ifaref(ifa);
743 return ifa;
753 for (ifa = ifp->if_addrhead.tqh_first; ifa;
754 ifa = ifa->ifa_link.tqe_next) {
757 if (ifa->ifa_addr->sa_family != af)
778 if (ifa->ifa_dstaddr != 0
779 && equal(addr, ifa->ifa_dstaddr)) {
797 if (ifa->ifa_claim_addr) {
798 if (ifa->ifa_claim_addr(ifa, addr)) {
806 * Scan all the bits in the ifa's address.
812 if (ifa->ifa_netmask == 0)
815 cp2 = ifa->ifa_addr->sa_data;
816 cp3 = ifa->ifa_netmask->sa_data;
817 cplim = ifa->ifa_netmask->sa_len
818 + (char *)ifa->ifa_netmask;
830 rn_refines((caddr_t)ifa->ifa_netmask,
832 ifaref(ifa);
835 ifa_maybe = ifa;
840 if (ifa) {
841 ifaref(ifa);
845 * ifa is set if we found an exact match.
846 * take a reference to the ifa before
851 if (ifa) {
856 if (!ifa)
857 ifa = ifa_maybe;
862 return ifa;
874 struct ifaddr *ifa = NULL;
885 for (ifa = ifp->if_addrhead.tqh_first; ifa;
886 ifa = ifa->ifa_link.tqe_next) {
887 if (ifa->ifa_addr->sa_family != af)
890 ifa_maybe = ifa;
891 if (ifa->ifa_netmask == 0) {
892 if (equal(addr, ifa->ifa_addr) ||
893 (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr)))
898 if (equal(addr, ifa->ifa_dstaddr))
901 if (equal(addr, ifa->ifa_addr)) {
906 cp2 = ifa->ifa_addr->sa_data;
907 cp3 = ifa->ifa_netmask->sa_data;
908 cplim = ifa->ifa_netmask->sa_len + (char *)ifa->ifa_netmask;
915 better_ifa_maybe = ifa;
921 if (ifa == NULL) {
923 ifa = better_ifa_maybe;
925 ifa = ifa_maybe;
928 if (ifa) ifaref(ifa);
931 return ifa;
938 * Lookup an appropriate real ifa to point to.
944 struct ifaddr *ifa;
948 if (cmd != RTM_ADD || ((ifa = rt->rt_ifa) == 0) ||
949 ((ifp = ifa->ifa_ifp) == 0) || ((dst = rt_key(rt)) == 0))
951 ifa = ifaof_ifpforaddr(dst, ifp);
952 if (ifa) {
953 rtsetifa(rt, ifa);
954 if (ifa->ifa_rtrequest && ifa->ifa_rtrequest != link_rtrequest)
955 ifa->ifa_rtrequest(cmd, rt, sa);
956 ifafree(ifa);
977 struct ifaddr **ifa;
1010 if (ifnet_get_address_list(ifp, &ifa) == 0) {
1011 for (i = 0; ifa[i] != 0; i++) {
1012 pfctlinput(up ? PRC_IFUP : PRC_IFDOWN, ifa[i]->ifa_addr);
1014 ifnet_free_address_list(ifa);
1594 struct ifaddr *ifa;
1623 ifa = ifp->if_addrhead.tqh_first;
1624 for ( ; space > sizeof (ifr) && ifa;
1625 ifa = ifa->ifa_link.tqe_next) {
1626 struct sockaddr *sa = ifa->ifa_addr;