• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.5.8/xnu-1228.15.4/bsd/netinet/

Lines Matching refs:route

77 #include <net/route.h>
229 * XXX: If this is a manually added route to interface
238 * Case 1: This route should come from a route to iface.
263 break; /* This happens on a route change */
265 * Case 2: This route may come from cloning, or a manual route
315 * the route to force traffic out to the hardware.
365 * arp_lookup_route will lookup the route for a given address.
375 route_t *route,
388 *route = rtalloc1_scoped_locked((struct sockaddr*)&sin,
390 if (*route == NULL)
393 rtunref(*route);
395 if ((*route)->rt_flags & RTF_GATEWAY) {
398 /* If there are no references to this route, purge it */
399 if ((*route)->rt_refcnt <= 0 && ((*route)->rt_flags & RTF_WASCLONED) != 0) {
401 (struct sockaddr *)rt_key(*route),
402 (*route)->rt_gateway, rt_mask(*route),
403 (*route)->rt_flags, 0);
405 *route = NULL;
408 else if (((*route)->rt_flags & RTF_LLINFO) == 0) {
410 *route = NULL;
413 else if ((*route)->rt_gateway->sa_family != AF_LINK) {
414 why = "gateway route is not ours";
415 *route = NULL;
435 * arp_route_to_gateway_route will find the gateway route for a given route.
437 * If the route is down, look the route up again.
438 * If the route goes through a gateway, get the route to the gateway.
439 * If the gateway route is down, look it up again.
440 * If the route is set to reject, verify it hasn't expired.
449 route_t route = hint;
453 if (route) {
456 if ((route->rt_flags & RTF_UP) == 0) {
457 /* route is down, find a new one */
458 hint = route = rtalloc1_scoped_locked(net_dest,
459 1, 0, route->rt_ifp->if_index);
464 /* No route to host */
470 if (route->rt_flags & RTF_GATEWAY) {
472 * We need the gateway route. If it is NULL or down,
475 if (route->rt_gwroute == 0 ||
476 (route->rt_gwroute->rt_flags & RTF_UP) == 0) {
477 if (route->rt_gwroute != 0)
478 rtfree_locked(route->rt_gwroute);
480 route->rt_gwroute = rtalloc1_scoped_locked(
481 route->rt_gateway, 1, 0,
482 route->rt_ifp->if_index);
483 if (route->rt_gwroute == 0) {
489 route = route->rt_gwroute;
492 if (route->rt_flags & RTF_REJECT) {
494 if (route->rt_rmx.rmx_expire == 0 ||
495 timenow.tv_sec < route->rt_rmx.rmx_expire) {
497 return route == hint ? EHOSTDOWN : EHOSTUNREACH;
504 *out_route = route;
517 route_t route = NULL;
530 * If we were given a route, verify the route and grab the gateway
534 hint, &route);
563 * If we didn't find a route, or the route doesn't have
565 * route and link layer information.
567 if (route == NULL || route->rt_llinfo == NULL)
568 result = arp_lookup_route(&net_dest->sin_addr, 1, 0, &route,
571 if (result || route == NULL || route->rt_llinfo == NULL) {
581 * Now that we have the right route, is it filled in?
583 gateway = SDL(route->rt_gateway);
585 if ((route->rt_rmx.rmx_expire == 0 || route->rt_rmx.rmx_expire > timenow.tv_sec) &&
600 llinfo = (struct llinfo_arp*)route->rt_llinfo;
608 if (route->rt_rmx.rmx_expire) {
609 route->rt_flags &= ~RTF_REJECT;
610 if (llinfo->la_asked == 0 || route->rt_rmx.rmx_expire != timenow.tv_sec) {
611 route->rt_rmx.rmx_expire = timenow.tv_sec;
614 dlil_send_arp(ifp, ARPOP_REQUEST, NULL, route->rt_ifa->ifa_addr,
619 route->rt_flags |= RTF_REJECT;
620 route->rt_rmx.rmx_expire += arpt_down;
645 route_t route = NULL;
719 sender_ip->sin_addr.s_addr != 0), 0, &route, ifp->if_index);
720 if (error || route == 0 || route->rt_gateway == 0) {
734 &route, ifp->if_index);
735 if (error == 0 && route && route->rt_gateway) {
736 gateway = SDL(route->rt_gateway);
737 if (route->rt_ifp != ifp && gateway->sdl_alen != 0
754 route->rt_ifp->if_name, route->rt_ifp->if_unit);
780 1, 0, &route, ifp->if_index);
781 if (error == 0 && route != NULL && route->rt_gateway != NULL) {
793 gateway = SDL(route->rt_gateway);
794 if (route->rt_ifp != ifp) {
800 route->rt_ifp->if_name,
801 route->rt_ifp->if_unit,
808 if (route->rt_rmx.rmx_expire == 0) {
813 * Don't change the cloned route away from the parent's interface
816 if (gateway->sdl_alen != 0 && route->rt_parent &&
817 route->rt_parent->rt_ifp == route->rt_ifp) {
821 /* Change the interface when the existing route is on */
822 route->rt_ifp = ifp;
823 rtsetifa(route, &best_ia->ia_ifa);
829 if (route->rt_rmx.rmx_expire && log_arp_warnings) {
838 else if (route->rt_rmx.rmx_expire == 0) {
852 /* Copy the sender hardware address in to the route's gateway address */
856 /* Update the expire time for the route and clear the reject flag */
857 if (route->rt_rmx.rmx_expire) {
861 route->rt_rmx.rmx_expire = timenow.tv_sec + arpt_keep;
863 route->rt_flags &= ~RTF_REJECT;
866 llinfo = (struct llinfo_arp*)route->rt_llinfo;
873 /* Should we a reference on the route first? */
875 dlil_output(ifp, PF_INET, m0, (caddr_t)route, rt_key(route), 0);
888 /* Find a proxy route */
890 &route, ifp->if_index);
891 if (error || route == NULL) {
893 /* We don't have a route entry indicating we should use proxy */
900 /* See if we have a route to the target ip before we proxy it */
901 route = rtalloc1_scoped_locked(
904 if (!route) {
912 if (route->rt_ifp == ifp) {
913 rtfree_locked(route);