Lines Matching refs:gwrt

1754 		struct rtentry *gwrt = NULL;
1813 if ((gwrt = rt->rt_gwroute) != NULL)
1854 * lock being acquired if gwrt is a clone of rt.
1856 if (gwrt != NULL)
1857 rtfree_locked(gwrt);
2419 struct rtentry *gwrt;
2435 gwrt = rtalloc1_scoped_locked(gate, 1, RTF_PRCLONING, ifscope);
2436 if (gwrt != NULL)
2437 RT_LOCK_ASSERT_NOTHELD(gwrt);
2454 if (gwrt == rt) {
2455 RT_REMREF_LOCKED(gwrt);
2463 * we're holding rnh_lock now, so rt_gateway and rt_ifp of gwrt
2467 gwrt != NULL && gwrt->rt_ifp != NULL &&
2468 gwrt->rt_ifp->if_index != ifscope) {
2469 rtfree_locked(gwrt); /* rt != gwrt, no deadlock */
2478 if (gwrt != NULL)
2479 rtfree_locked(gwrt);
2485 /* Set gateway route; callee adds ref to gwrt if non-NULL */
2486 rt_set_gwroute(rt, dst, gwrt);
2508 gwrt != NULL && gwrt->rt_gateway->sa_family == AF_LINK &&
2509 (gwrt->rt_ifp->if_index == get_primary_ifscope(AF_INET) ||
2511 kdp_set_gateway_mac(SDL((void *)gwrt->rt_gateway)->
2516 if (gwrt != NULL)
2517 RT_REMREF(gwrt);
2558 * For consistency between rt_gateway and rt_key(gwrt).
2596 rt_set_gwroute(struct rtentry *rt, struct sockaddr *dst, struct rtentry *gwrt)
2603 if (gwrt != NULL)
2604 RT_ADDREF(gwrt); /* for this routine */
2608 * set to gwrt, this is slightly redundant (though safe since
2625 if ((rt->rt_gwroute = gwrt) != NULL) {
2626 RT_ADDREF(gwrt); /* for rt */
2637 /* If gwrt points to a default router, mark it accordingly */
2638 if (gwrt_isrouter && RT_HOST(gwrt) &&
2639 !(gwrt->rt_flags & RTF_ROUTER)) {
2640 RT_LOCK(gwrt);
2641 gwrt->rt_flags |= RTF_ROUTER;
2642 RT_UNLOCK(gwrt);
2645 RT_REMREF(gwrt); /* for this routine */
3641 struct rtentry *gwrt = rt->rt_gwroute;
3649 if (gwrt == NULL) {
3659 * Take gwrt's lock while holding route's lock;
3660 * this is okay since gwrt never points back
3663 RT_LOCK_SPIN(gwrt);
3664 if (!(gwrt->rt_flags & RTF_UP)) {
3666 RT_UNLOCK(gwrt);
3670 rtfree(gwrt);
3673 gwrt = rtalloc1_scoped_locked(gw, 1, 0, ifindex);
3681 if (!(rt->rt_flags & RTF_UP) || gwrt == NULL ||
3682 gwrt == rt || !equal(gw, rt->rt_gateway)) {
3683 if (gwrt == rt) {
3684 RT_REMREF_LOCKED(gwrt);
3685 gwrt = NULL;
3691 if (gwrt != NULL)
3692 rtfree_locked(gwrt);
3696 VERIFY(gwrt != NULL);
3698 * Set gateway route; callee adds ref to gwrt;
3699 * gwrt has an extra ref from rtalloc1() for
3702 rt_set_gwroute(rt, rt_key(rt), gwrt);
3707 rt = gwrt;
3709 RT_ADDREF_LOCKED(gwrt);
3710 RT_UNLOCK(gwrt);
3714 rt = gwrt;
3716 VERIFY(rt == gwrt && rt != hint);
3722 * a reference to it. rt == gwrt.
3746 /* rt == gwrt; if it is now down, give up */
3772 /* Clean up route (either it is "rt" or "gwrt") */
3788 rt_revalidate_gwroute(struct rtentry *rt, struct rtentry *gwrt)
3791 VERIFY(gwrt != NULL);
3795 rt->rt_ifp == gwrt->rt_ifp && rt->rt_gateway->sa_family ==
3796 rt_key(gwrt)->sa_family && (rt->rt_gwroute == NULL ||
3807 (void) sa_copy(rt_key(gwrt), &key_ss, NULL);
3812 isequal = equal(rt_key(gwrt), rt->rt_gateway);
3815 /* If they are the same, update gwrt */
3820 rt_set_gwroute(rt, rt_key(rt), gwrt);