| 128 | #endif |
| 129 | |
| 130 | static void |
| 131 | destroy_rtentry(struct rtentry *rt) |
| 132 | { |
| 133 | #ifdef VIMAGE |
| 134 | struct nhop_object *nh = rt->rt_nhop; |
| 135 | |
| 136 | /* |
| 137 | * At this moment rnh, nh_control may be already freed. |
| 138 | * nhop interface may have been migrated to a different vnet. |
| 139 | * Use vnet stored in the nexthop to delete the entry. |
| 140 | */ |
| 141 | #ifdef ROUTE_MPATH |
| 142 | if (NH_IS_NHGRP(nh)) { |
| 143 | struct weightened_nhop *wn; |
| 144 | uint32_t num_nhops; |
| 145 | wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); |
| 146 | nh = wn[0].nh; |
| 147 | } |
| 148 | #endif |
| 149 | CURVNET_SET(nhop_get_vnet(nh)); |
| 150 | #endif |
| 151 | |
| 152 | /* Unreference nexthop */ |
| 153 | nhop_free_any(rt->rt_nhop); |
| 154 | |
| 155 | uma_zfree(V_rtzone, rt); |
| 156 | |
| 157 | CURVNET_RESTORE(); |
| 158 | } |
| 159 | |
| 160 | /* |
| 161 | * Epoch callback indicating rtentry is safe to destroy |
no test coverage detected