Lines Matching refs:dst
53 static void xfrm_init_pmtu(struct dst_entry *dst);
54 static int stale_bundle(struct dst_entry *dst);
124 struct dst_entry *dst; in __xfrm_dst_lookup() local
130 dst = afinfo->dst_lookup(net, tos, saddr, daddr); in __xfrm_dst_lookup()
134 return dst; in __xfrm_dst_lookup()
145 struct dst_entry *dst; in xfrm_dst_lookup() local
156 dst = __xfrm_dst_lookup(net, tos, saddr, daddr, family); in xfrm_dst_lookup()
158 if (!IS_ERR(dst)) { in xfrm_dst_lookup()
165 return dst; in xfrm_dst_lookup()
1510 struct dst_entry *dst = &xdst->u.dst; in xfrm_bundle_flo_get() local
1518 } else if (dst->flags & DST_XFRM_QUEUE) { in xfrm_bundle_flo_get()
1522 if (stale_bundle(dst)) in xfrm_bundle_flo_get()
1526 dst_hold(dst); in xfrm_bundle_flo_get()
1533 struct dst_entry *dst = &xdst->u.dst; in xfrm_bundle_flo_check() local
1537 if (stale_bundle(dst)) in xfrm_bundle_flo_check()
1546 struct dst_entry *dst = &xdst->u.dst; in xfrm_bundle_flo_delete() local
1548 dst_free(dst); in xfrm_bundle_flo_delete()
1581 struct dst_entry *dst = &xdst->u.dst; in xfrm_alloc_dst() local
1583 memset(dst + 1, 0, sizeof(*xdst) - sizeof(*dst)); in xfrm_alloc_dst()
1595 static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst, in xfrm_init_path() argument
1599 xfrm_policy_get_afinfo(dst->ops->family); in xfrm_init_path()
1605 err = afinfo->init_path(path, dst, nfheader_len); in xfrm_init_path()
1616 xfrm_policy_get_afinfo(xdst->u.dst.ops->family); in xfrm_fill_dst()
1637 struct dst_entry *dst) in xfrm_bundle_create() argument
1661 dst_hold(dst); in xfrm_bundle_create()
1665 struct dst_entry *dst1 = &xdst->u.dst; in xfrm_bundle_create()
1669 dst_release(dst); in xfrm_bundle_create()
1678 dst_release(dst); in xfrm_bundle_create()
1691 xdst->route = dst; in xfrm_bundle_create()
1692 dst_copy_metrics(dst1, dst); in xfrm_bundle_create()
1696 dst = xfrm_dst_lookup(xfrm[i], tos, &saddr, &daddr, in xfrm_bundle_create()
1698 err = PTR_ERR(dst); in xfrm_bundle_create()
1699 if (IS_ERR(dst)) in xfrm_bundle_create()
1702 dst_hold(dst); in xfrm_bundle_create()
1723 dst_prev->child = dst; in xfrm_bundle_create()
1724 dst0->path = dst; in xfrm_bundle_create()
1727 dev = dst->dev; in xfrm_bundle_create()
1731 xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len); in xfrm_bundle_create()
1734 for (dst_prev = dst0; dst_prev != dst; dst_prev = dst_prev->child) { in xfrm_bundle_create()
1743 header_len -= xdst->u.dst.xfrm->props.header_len; in xfrm_bundle_create()
1744 trailer_len -= xdst->u.dst.xfrm->props.trailer_len; in xfrm_bundle_create()
1774 static int xfrm_dst_update_parent(struct dst_entry *dst, in xfrm_dst_update_parent() argument
1778 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_dst_update_parent()
1786 static int xfrm_dst_update_origin(struct dst_entry *dst, in xfrm_dst_update_origin() argument
1790 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_dst_update_origin()
1848 struct dst_entry *dst; in xfrm_resolve_and_create_bundle() local
1860 dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig); in xfrm_resolve_and_create_bundle()
1861 if (IS_ERR(dst)) { in xfrm_resolve_and_create_bundle()
1863 return ERR_CAST(dst); in xfrm_resolve_and_create_bundle()
1866 xdst = (struct xfrm_dst *)dst; in xfrm_resolve_and_create_bundle()
1869 err = xfrm_dst_update_parent(dst, &pols[1]->selector); in xfrm_resolve_and_create_bundle()
1871 err = xfrm_dst_update_origin(dst, fl); in xfrm_resolve_and_create_bundle()
1873 dst_free(dst); in xfrm_resolve_and_create_bundle()
1889 struct dst_entry *dst; in xfrm_policy_queue_process() local
1901 dst = skb_dst(skb); in xfrm_policy_queue_process()
1903 xfrm_decode_session(skb, &fl, dst->ops->family); in xfrm_policy_queue_process()
1906 dst_hold(dst->path); in xfrm_policy_queue_process()
1907 dst = xfrm_lookup(xp_net(pol), dst->path, &fl, in xfrm_policy_queue_process()
1909 if (IS_ERR(dst)) in xfrm_policy_queue_process()
1912 if (dst->flags & DST_XFRM_QUEUE) { in xfrm_policy_queue_process()
1913 dst_release(dst); in xfrm_policy_queue_process()
1924 dst_release(dst); in xfrm_policy_queue_process()
1938 dst = xfrm_lookup(xp_net(pol), skb_dst(skb)->path, in xfrm_policy_queue_process()
1940 if (IS_ERR(dst)) { in xfrm_policy_queue_process()
1947 skb_dst_set(skb, dst); in xfrm_policy_queue_process()
1965 struct dst_entry *dst = skb_dst(skb); in xdst_queue_output() local
1966 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; in xdst_queue_output()
2012 struct dst_entry *dst; in xfrm_create_dummy_bundle() local
2025 dst = xflo->dst_orig; in xfrm_create_dummy_bundle()
2026 dst1 = &xdst->u.dst; in xfrm_create_dummy_bundle()
2027 dst_hold(dst); in xfrm_create_dummy_bundle()
2028 xdst->route = dst; in xfrm_create_dummy_bundle()
2030 dst_copy_metrics(dst1, dst); in xfrm_create_dummy_bundle()
2039 dst_hold(dst); in xfrm_create_dummy_bundle()
2040 dst1->child = dst; in xfrm_create_dummy_bundle()
2041 dst1->path = dst; in xfrm_create_dummy_bundle()
2043 xfrm_init_path((struct xfrm_dst *)dst1, dst, 0); in xfrm_create_dummy_bundle()
2046 dev = dst->dev; in xfrm_create_dummy_bundle()
2084 dst_free(&xdst->u.dst); in xfrm_bundle_lookup()
2116 dst_hold(&xdst->u.dst); in xfrm_bundle_lookup()
2123 dst_hold(&xdst->u.dst); in xfrm_bundle_lookup()
2131 dst_free(&xdst->u.dst); in xfrm_bundle_lookup()
2136 dst_hold(&new_xdst->u.dst); in xfrm_bundle_lookup()
2152 dst_hold(&xdst->u.dst); in xfrm_bundle_lookup()
2159 dst_free(&xdst->u.dst); in xfrm_bundle_lookup()
2194 struct dst_entry *dst, *route; in xfrm_lookup() local
2199 dst = NULL; in xfrm_lookup()
2230 dst_hold(&xdst->u.dst); in xfrm_lookup()
2231 xdst->u.dst.flags |= DST_NOCACHE; in xfrm_lookup()
2263 dst = &xdst->u.dst; in xfrm_lookup()
2306 dst_release(dst); in xfrm_lookup()
2307 dst = dst_orig; in xfrm_lookup()
2311 if (dst && dst->xfrm && in xfrm_lookup()
2312 dst->xfrm->props.mode == XFRM_MODE_TUNNEL) in xfrm_lookup()
2313 dst->flags |= DST_XFRM_TUNNEL; in xfrm_lookup()
2314 return dst; in xfrm_lookup()
2318 dst = dst_orig; in xfrm_lookup()
2323 dst_release(dst); in xfrm_lookup()
2339 struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, in xfrm_lookup_route() local
2343 if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) in xfrm_lookup_route()
2346 return dst; in xfrm_lookup_route()
2605 struct dst_entry *dst; in __xfrm_route_forward() local
2615 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE); in __xfrm_route_forward()
2616 if (IS_ERR(dst)) { in __xfrm_route_forward()
2618 dst = NULL; in __xfrm_route_forward()
2620 skb_dst_set(skb, dst); in __xfrm_route_forward()
2627 static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie) in xfrm_dst_check() argument
2650 if (dst->obsolete < 0 && !stale_bundle(dst)) in xfrm_dst_check()
2651 return dst; in xfrm_dst_check()
2656 static int stale_bundle(struct dst_entry *dst) in stale_bundle() argument
2658 return !xfrm_bundle_ok((struct xfrm_dst *)dst); in stale_bundle()
2661 void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) in xfrm_dst_ifdown() argument
2663 while ((dst = dst->child) && dst->xfrm && dst->dev == dev) { in xfrm_dst_ifdown()
2664 dst->dev = dev_net(dev)->loopback_dev; in xfrm_dst_ifdown()
2665 dev_hold(dst->dev); in xfrm_dst_ifdown()
2676 static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst) in xfrm_negative_advice() argument
2678 if (dst) { in xfrm_negative_advice()
2679 if (dst->obsolete) { in xfrm_negative_advice()
2680 dst_release(dst); in xfrm_negative_advice()
2681 dst = NULL; in xfrm_negative_advice()
2684 return dst; in xfrm_negative_advice()
2698 static void xfrm_init_pmtu(struct dst_entry *dst) in xfrm_init_pmtu() argument
2701 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_init_pmtu()
2704 pmtu = dst_mtu(dst->child); in xfrm_init_pmtu()
2707 pmtu = xfrm_state_mtu(dst->xfrm, pmtu); in xfrm_init_pmtu()
2715 dst_metric_set(dst, RTAX_MTU, pmtu); in xfrm_init_pmtu()
2716 } while ((dst = dst->next)); in xfrm_init_pmtu()
2725 struct dst_entry *dst = &first->u.dst; in xfrm_bundle_ok() local
2729 if (!dst_check(dst->path, ((struct xfrm_dst *)dst)->path_cookie) || in xfrm_bundle_ok()
2730 (dst->dev && !netif_running(dst->dev))) in xfrm_bundle_ok()
2733 if (dst->flags & DST_XFRM_QUEUE) in xfrm_bundle_ok()
2739 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_bundle_ok()
2741 if (dst->xfrm->km.state != XFRM_STATE_VALID) in xfrm_bundle_ok()
2743 if (xdst->xfrm_genid != dst->xfrm->genid) in xfrm_bundle_ok()
2749 mtu = dst_mtu(dst->child); in xfrm_bundle_ok()
2763 dst = dst->child; in xfrm_bundle_ok()
2764 } while (dst->xfrm); in xfrm_bundle_ok()
2771 dst = &last->u.dst; in xfrm_bundle_ok()
2773 mtu = xfrm_state_mtu(dst->xfrm, mtu); in xfrm_bundle_ok()
2776 dst_metric_set(dst, RTAX_MTU, mtu); in xfrm_bundle_ok()
2781 last = (struct xfrm_dst *)last->u.dst.next; in xfrm_bundle_ok()
2788 static unsigned int xfrm_default_advmss(const struct dst_entry *dst) in xfrm_default_advmss() argument
2790 return dst_metric_advmss(dst->path); in xfrm_default_advmss()
2793 static unsigned int xfrm_mtu(const struct dst_entry *dst) in xfrm_mtu() argument
2795 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); in xfrm_mtu()
2797 return mtu ? : dst_mtu(dst->path); in xfrm_mtu()
2800 static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, in xfrm_neigh_lookup() argument
2804 return dst->path->ops->neigh_lookup(dst, skb, daddr); in xfrm_neigh_lookup()