Lines Matching defs:gwrt

1674 		struct rtentry *gwrt = NULL;
1726 if ((gwrt = rt->rt_gwroute) != NULL)
1768 * lock being acquired if gwrt is a clone of rt.
1770 if (gwrt != NULL)
1771 rtfree_locked(gwrt);
2305 struct rtentry *gwrt;
2321 gwrt = rtalloc1_scoped_locked(gate, 1, RTF_PRCLONING, ifscope);
2322 if (gwrt != NULL)
2323 RT_LOCK_ASSERT_NOTHELD(gwrt);
2340 if (gwrt == rt) {
2341 RT_REMREF_LOCKED(gwrt);
2349 * we're holding rnh_lock now, so rt_gateway and rt_ifp of gwrt
2353 gwrt != NULL && gwrt->rt_ifp != NULL &&
2354 gwrt->rt_ifp->if_index != ifscope) {
2355 rtfree_locked(gwrt); /* rt != gwrt, no deadlock */
2364 if (gwrt != NULL)
2365 rtfree_locked(gwrt);
2371 /* Set gateway route; callee adds ref to gwrt if non-NULL */
2372 rt_set_gwroute(rt, dst, gwrt);
2394 gwrt != NULL && gwrt->rt_gateway->sa_family == AF_LINK &&
2395 (gwrt->rt_ifp->if_index == get_primary_ifscope(AF_INET) ||
2397 kdp_set_gateway_mac(SDL((void *)gwrt->rt_gateway)->
2402 if (gwrt != NULL)
2403 RT_REMREF(gwrt);
2444 * For consistency between rt_gateway and rt_key(gwrt).
2482 rt_set_gwroute(struct rtentry *rt, struct sockaddr *dst, struct rtentry *gwrt)
2489 if (gwrt != NULL)
2490 RT_ADDREF(gwrt); /* for this routine */
2494 * set to gwrt, this is slightly redundant (though safe since
2511 if ((rt->rt_gwroute = gwrt) != NULL) {
2512 RT_ADDREF(gwrt); /* for rt */
2523 /* If gwrt points to a default router, mark it accordingly */
2524 if (gwrt_isrouter && RT_HOST(gwrt) &&
2525 !(gwrt->rt_flags & RTF_ROUTER)) {
2526 RT_LOCK(gwrt);
2527 gwrt->rt_flags |= RTF_ROUTER;
2528 RT_UNLOCK(gwrt);
2531 RT_REMREF(gwrt); /* for this routine */
3379 struct rtentry *gwrt = rt->rt_gwroute;
3387 if (gwrt == NULL) {
3397 * Take gwrt's lock while holding route's lock;
3398 * this is okay since gwrt never points back
3401 RT_LOCK_SPIN(gwrt);
3402 if (!(gwrt->rt_flags & RTF_UP)) {
3404 RT_UNLOCK(gwrt);
3408 rtfree(gwrt);
3411 gwrt = rtalloc1_scoped_locked(gw, 1, 0, ifindex);
3419 if (!(rt->rt_flags & RTF_UP) || gwrt == NULL ||
3420 gwrt == rt || !equal(gw, rt->rt_gateway)) {
3421 if (gwrt == rt) {
3422 RT_REMREF_LOCKED(gwrt);
3423 gwrt = NULL;
3429 if (gwrt != NULL)
3430 rtfree_locked(gwrt);
3434 VERIFY(gwrt != NULL);
3436 * Set gateway route; callee adds ref to gwrt;
3437 * gwrt has an extra ref from rtalloc1() for
3440 rt_set_gwroute(rt, rt_key(rt), gwrt);
3445 rt = gwrt;
3447 RT_ADDREF_LOCKED(gwrt);
3448 RT_UNLOCK(gwrt);
3452 rt = gwrt;
3454 VERIFY(rt == gwrt && rt != hint);
3460 * a reference to it. rt == gwrt.
3484 /* rt == gwrt; if it is now down, give up */
3510 /* Clean up route (either it is "rt" or "gwrt") */
3526 rt_revalidate_gwroute(struct rtentry *rt, struct rtentry *gwrt)
3529 VERIFY(gwrt != NULL);
3533 rt->rt_ifp == gwrt->rt_ifp && rt->rt_gateway->sa_family ==
3534 rt_key(gwrt)->sa_family && (rt->rt_gwroute == NULL ||
3545 (void) sa_copy(rt_key(gwrt), &key_ss, NULL);
3550 isequal = equal(rt_key(gwrt), rt->rt_gateway);
3553 /* If they are the same, update gwrt */
3558 rt_set_gwroute(rt, rt_key(rt), gwrt);