Lines Matching refs:ifa
747 rtsetifa(struct rtentry *rt, struct ifaddr* ifa)
752 if (rt->rt_ifa == ifa)
755 /* Release the old ifa */
760 rt->rt_ifa = ifa;
762 /* Take a reference to the ifa */
768 ifafree(struct ifaddr *ifa)
772 if (ifa == NULL)
775 oldval = OSAddAtomic(-1, (SInt32 *)&ifa->ifa_refcnt);
778 if ((ifa->ifa_debug & IFA_ATTACHED) != 0) {
779 panic("ifa attached to ifp is being freed\n");
781 FREE(ifa, M_IFADDR);
786 ifaref(struct ifaddr *ifa)
788 if (ifa == NULL)
791 if (OSAddAtomic(1, (SInt32 *)&ifa->ifa_refcnt) == 0xffffffff)
810 struct ifaddr *ifa = NULL;
822 if ((ifa = ifa_ifwithnet_scoped(gateway, ifscope)) == NULL) {
842 ifa->ifa_addr))) {
845 ifafree(ifa);
846 if ((ifa = ifa_ifwithaddr(gateway))) {
847 ifafree(ifa);
848 ifa = NULL;
853 if (ifa) {
854 ifafree(ifa);
855 ifa = NULL;
946 struct ifaddr *ifa;
949 ifa = ifa_ifwithroute_locked(flags, dst, gateway);
952 return (ifa);
979 struct ifaddr *ifa = NULL;
1006 ifa = ifa_ifwithdstaddr(dst);
1008 if (ifa == NULL)
1009 ifa = ifa_ifwithaddr_scoped(gateway, ifscope);
1016 ifa = ifa_ifwithdstaddr(gateway);
1018 if (ifa == NULL)
1019 ifa = ifa_ifwithnet_scoped(gateway, ifscope);
1020 if (ifa == NULL) {
1025 ifa = rt->rt_ifa;
1026 if (ifa != NULL)
1027 ifaref(ifa);
1032 if (ifa != NULL && ifa->ifa_addr->sa_family != dst->sa_family) {
1035 newifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp);
1037 ifafree(ifa);
1038 ifa = newifa;
1047 * on new entries from rtinit, hence (ifa->ifa_addr != gateway).
1049 if ((ifa == NULL ||
1050 !equal(ifa->ifa_addr, (struct sockaddr *)(size_t)gateway)) &&
1053 if (ifa != NULL)
1054 ifafree(ifa);
1055 ifa = rt->rt_ifa;
1056 if (ifa != NULL)
1057 ifaref(ifa);
1066 ifa != NULL && ifa->ifa_ifp->if_index != ifscope) {
1067 ifafree(ifa);
1068 ifa = NULL;
1071 return (ifa);
1130 struct ifaddr *ifa = NULL;
1226 if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)
1227 ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0));
1228 ifa = NULL;
1264 ifa = rt->rt_ifa;
1265 ifaref(ifa);
1307 ifa = ifa_ifwithroute_scoped_locked(flags, dst0,
1310 ifa = ifa_ifwithroute_locked(flags, dst0, gateway);
1312 if (ifa == NULL)
1343 * Note that we now have a reference to the ifa.
1345 * examine the ifa and ifa->ifa_ifp if it so desires.
1347 rtsetifa(rt, ifa);
1419 if (ifa->ifa_rtrequest)
1420 ifa->ifa_rtrequest(req, rt, SA(ret_nrt ? *ret_nrt : 0));
1421 ifafree(ifa);
1422 ifa = 0;
1455 if (ifa)
1456 ifafree(ifa);
1945 rtinit(struct ifaddr *ifa, int cmd, int flags)
1950 error = rtinit_locked(ifa, cmd, flags);
1956 rtinit_locked(struct ifaddr *ifa, int cmd, int flags)
1965 dst = flags & RTF_HOST ? ifa->ifa_dstaddr : ifa->ifa_addr;
1968 * interface or we might scrub a route to another ifa which would
1977 if ((flags & RTF_HOST) == 0 && ifa->ifa_netmask) {
1983 rt_maskedcopy(dst, deldst, ifa->ifa_netmask);
2000 if (rt->rt_ifa != ifa) {
2031 error = rtrequest_locked(cmd, dst, ifa->ifa_addr, ifa->ifa_netmask,
2032 flags | ifa->ifa_flags, &nrt);
2043 rt_newaddrmsg(cmd, ifa, error, nrt);
2058 if (rt->rt_ifa != ifa) {
2061 printf("rtinit: wrong ifa (%p) was (%p)\n",
2062 ifa, rt->rt_ifa);
2071 * Set the route's ifa.
2073 rtsetifa(rt, ifa);
2078 rt->rt_ifp = ifa->ifa_ifp;
2079 rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; /*XXX*/
2084 if (ifa->ifa_rtrequest)
2085 ifa->ifa_rtrequest(RTM_ADD, rt, SA(0));
2090 rt_newaddrmsg(cmd, ifa, error, nrt);