Lines 903-909
rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info, int flags)
Link Here
|
903 |
info->rti_flags = rt->rt_flags; |
903 |
info->rti_flags = rt->rt_flags; |
904 |
info->rti_ifp = rt->rt_ifp; |
904 |
info->rti_ifp = rt->rt_ifp; |
905 |
info->rti_ifa = rt->rt_ifa; |
905 |
info->rti_ifa = rt->rt_ifa; |
906 |
ifa_ref(info->rti_ifa); |
|
|
907 |
if (flags & NHR_REF) { |
906 |
if (flags & NHR_REF) { |
908 |
/* Do 'traditional' refcouting */ |
907 |
/* Do 'traditional' refcouting */ |
909 |
if_ref(info->rti_ifp); |
908 |
if_ref(info->rti_ifp); |
Lines 1631-1639
rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
Link Here
|
1631 |
error = rt_getifa_fib(info, fibnum); |
1630 |
error = rt_getifa_fib(info, fibnum); |
1632 |
if (error) |
1631 |
if (error) |
1633 |
return (error); |
1632 |
return (error); |
|
|
1633 |
} else { |
1634 |
ifa_ref(info->rti_ifa); |
1634 |
} |
1635 |
} |
1635 |
rt = uma_zalloc(V_rtzone, M_NOWAIT); |
1636 |
rt = uma_zalloc(V_rtzone, M_NOWAIT); |
1636 |
if (rt == NULL) { |
1637 |
if (rt == NULL) { |
|
|
1638 |
ifa_free(info->rti_ifa); |
1637 |
return (ENOBUFS); |
1639 |
return (ENOBUFS); |
1638 |
} |
1640 |
} |
1639 |
rt->rt_flags = RTF_UP | flags; |
1641 |
rt->rt_flags = RTF_UP | flags; |
Lines 1642-1647
rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
Link Here
|
1642 |
* Add the gateway. Possibly re-malloc-ing the storage for it. |
1644 |
* Add the gateway. Possibly re-malloc-ing the storage for it. |
1643 |
*/ |
1645 |
*/ |
1644 |
if ((error = rt_setgate(rt, dst, gateway)) != 0) { |
1646 |
if ((error = rt_setgate(rt, dst, gateway)) != 0) { |
|
|
1647 |
ifa_free(info->rti_ifa); |
1645 |
uma_zfree(V_rtzone, rt); |
1648 |
uma_zfree(V_rtzone, rt); |
1646 |
return (error); |
1649 |
return (error); |
1647 |
} |
1650 |
} |
Lines 1665-1671
rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
Link Here
|
1665 |
* examine the ifa and ifa->ifa_ifp if it so desires. |
1668 |
* examine the ifa and ifa->ifa_ifp if it so desires. |
1666 |
*/ |
1669 |
*/ |
1667 |
ifa = info->rti_ifa; |
1670 |
ifa = info->rti_ifa; |
1668 |
ifa_ref(ifa); |
|
|
1669 |
rt->rt_ifa = ifa; |
1671 |
rt->rt_ifa = ifa; |
1670 |
rt->rt_ifp = ifa->ifa_ifp; |
1672 |
rt->rt_ifp = ifa->ifa_ifp; |
1671 |
rt->rt_weight = 1; |
1673 |
rt->rt_weight = 1; |
Lines 2108-2114
rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
Link Here
|
2108 |
* Do the actual request |
2110 |
* Do the actual request |
2109 |
*/ |
2111 |
*/ |
2110 |
bzero((caddr_t)&info, sizeof(info)); |
2112 |
bzero((caddr_t)&info, sizeof(info)); |
2111 |
ifa_ref(ifa); |
|
|
2112 |
info.rti_ifa = ifa; |
2113 |
info.rti_ifa = ifa; |
2113 |
info.rti_flags = flags | |
2114 |
info.rti_flags = flags | |
2114 |
(ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; |
2115 |
(ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; |
Lines 2122-2128
rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
Link Here
|
2122 |
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; |
2123 |
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; |
2123 |
info.rti_info[RTAX_NETMASK] = netmask; |
2124 |
info.rti_info[RTAX_NETMASK] = netmask; |
2124 |
error = rtrequest1_fib(cmd, &info, &rt, fibnum); |
2125 |
error = rtrequest1_fib(cmd, &info, &rt, fibnum); |
2125 |
|
|
|
2126 |
if (error == 0 && rt != NULL) { |
2126 |
if (error == 0 && rt != NULL) { |
2127 |
/* |
2127 |
/* |
2128 |
* notify any listening routing agents of the change |
2128 |
* notify any listening routing agents of the change |