Lines Matching refs:dst
53 static void xfrm_init_pmtu(struct dst_entry *dst);
54 static int stale_bundle(struct dst_entry *dst);
125 struct dst_entry *dst; in __xfrm_dst_lookup() local
131 dst = afinfo->dst_lookup(net, tos, oif, saddr, daddr); in __xfrm_dst_lookup()
135 return dst; in __xfrm_dst_lookup()
147 struct dst_entry *dst; in xfrm_dst_lookup() local
158 dst = __xfrm_dst_lookup(net, tos, oif, saddr, daddr, family); in xfrm_dst_lookup()
160 if (!IS_ERR(dst)) { in xfrm_dst_lookup()
167 return dst; in xfrm_dst_lookup()
1531 struct dst_entry *dst = &xdst->u.dst; in xfrm_bundle_flo_get() local
1539 } else if (dst->flags & DST_XFRM_QUEUE) { in xfrm_bundle_flo_get()
1543 if (stale_bundle(dst)) in xfrm_bundle_flo_get()
1547 dst_hold(dst); in xfrm_bundle_flo_get()
1554 struct dst_entry *dst = &xdst->u.dst; in xfrm_bundle_flo_check() local
1558 if (stale_bundle(dst)) in xfrm_bundle_flo_check()
1567 struct dst_entry *dst = &xdst->u.dst; in xfrm_bundle_flo_delete() local
1569 dst_free(dst); in xfrm_bundle_flo_delete()
1602 struct dst_entry *dst = &xdst->u.dst; in xfrm_alloc_dst() local
1604 memset(dst + 1, 0, sizeof(*xdst) - sizeof(*dst)); in xfrm_alloc_dst()
1614 static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst, in xfrm_init_path() argument
1618 xfrm_policy_get_afinfo(dst->ops->family); in xfrm_init_path()
1624 err = afinfo->init_path(path, dst, nfheader_len); in xfrm_init_path()
1635 xfrm_policy_get_afinfo(xdst->u.dst.ops->family); in xfrm_fill_dst()
1656 struct dst_entry *dst) in xfrm_bundle_create() argument
1680 dst_hold(dst); in xfrm_bundle_create()
1684 struct dst_entry *dst1 = &xdst->u.dst; in xfrm_bundle_create()
1688 dst_release(dst); in xfrm_bundle_create()
1697 dst_release(dst); in xfrm_bundle_create()
1710 xdst->route = dst; in xfrm_bundle_create()
1711 dst_copy_metrics(dst1, dst); in xfrm_bundle_create()
1715 dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif, in xfrm_bundle_create()
1717 err = PTR_ERR(dst); in xfrm_bundle_create()
1718 if (IS_ERR(dst)) in xfrm_bundle_create()
1721 dst_hold(dst); in xfrm_bundle_create()
1742 dst_prev->child = dst; in xfrm_bundle_create()
1743 dst0->path = dst; in xfrm_bundle_create()
1746 dev = dst->dev; in xfrm_bundle_create()
1750 xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len); in xfrm_bundle_create()
1753 for (dst_prev = dst0; dst_prev != dst; dst_prev = dst_prev->child) { in xfrm_bundle_create()
1762 header_len -= xdst->u.dst.xfrm->props.header_len; in xfrm_bundle_create()
1763 trailer_len -= xdst->u.dst.xfrm->props.trailer_len; in xfrm_bundle_create()
1793 static int xfrm_dst_update_parent(struct dst_entry *dst, in xfrm_dst_update_parent() argument
1797 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_dst_update_parent()
1805 static int xfrm_dst_update_origin(struct dst_entry *dst, in xfrm_dst_update_origin() argument
1809 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_dst_update_origin()
1867 struct dst_entry *dst; in xfrm_resolve_and_create_bundle() local
1879 dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig); in xfrm_resolve_and_create_bundle()
1880 if (IS_ERR(dst)) { in xfrm_resolve_and_create_bundle()
1882 return ERR_CAST(dst); in xfrm_resolve_and_create_bundle()
1885 xdst = (struct xfrm_dst *)dst; in xfrm_resolve_and_create_bundle()
1888 err = xfrm_dst_update_parent(dst, &pols[1]->selector); in xfrm_resolve_and_create_bundle()
1890 err = xfrm_dst_update_origin(dst, fl); in xfrm_resolve_and_create_bundle()
1892 dst_free(dst); in xfrm_resolve_and_create_bundle()
1908 struct dst_entry *dst; in xfrm_policy_queue_process() local
1921 dst = skb_dst(skb); in xfrm_policy_queue_process()
1923 xfrm_decode_session(skb, &fl, dst->ops->family); in xfrm_policy_queue_process()
1926 dst_hold(dst->path); in xfrm_policy_queue_process()
1927 dst = xfrm_lookup(net, dst->path, &fl, sk, 0); in xfrm_policy_queue_process()
1928 if (IS_ERR(dst)) in xfrm_policy_queue_process()
1931 if (dst->flags & DST_XFRM_QUEUE) { in xfrm_policy_queue_process()
1932 dst_release(dst); in xfrm_policy_queue_process()
1943 dst_release(dst); in xfrm_policy_queue_process()
1957 dst = xfrm_lookup(net, skb_dst(skb)->path, &fl, skb->sk, 0); in xfrm_policy_queue_process()
1958 if (IS_ERR(dst)) { in xfrm_policy_queue_process()
1965 skb_dst_set(skb, dst); in xfrm_policy_queue_process()
1983 struct dst_entry *dst = skb_dst(skb); in xdst_queue_output() local
1984 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; in xdst_queue_output()
2030 struct dst_entry *dst; in xfrm_create_dummy_bundle() local
2043 dst = xflo->dst_orig; in xfrm_create_dummy_bundle()
2044 dst1 = &xdst->u.dst; in xfrm_create_dummy_bundle()
2045 dst_hold(dst); in xfrm_create_dummy_bundle()
2046 xdst->route = dst; in xfrm_create_dummy_bundle()
2048 dst_copy_metrics(dst1, dst); in xfrm_create_dummy_bundle()
2057 dst_hold(dst); in xfrm_create_dummy_bundle()
2058 dst1->child = dst; in xfrm_create_dummy_bundle()
2059 dst1->path = dst; in xfrm_create_dummy_bundle()
2061 xfrm_init_path((struct xfrm_dst *)dst1, dst, 0); in xfrm_create_dummy_bundle()
2064 dev = dst->dev; in xfrm_create_dummy_bundle()
2102 dst_free(&xdst->u.dst); in xfrm_bundle_lookup()
2134 dst_hold(&xdst->u.dst); in xfrm_bundle_lookup()
2141 dst_hold(&xdst->u.dst); in xfrm_bundle_lookup()
2149 dst_free(&xdst->u.dst); in xfrm_bundle_lookup()
2154 dst_hold(&new_xdst->u.dst); in xfrm_bundle_lookup()
2170 dst_hold(&xdst->u.dst); in xfrm_bundle_lookup()
2177 dst_free(&xdst->u.dst); in xfrm_bundle_lookup()
2212 struct dst_entry *dst, *route; in xfrm_lookup() local
2217 dst = NULL; in xfrm_lookup()
2249 dst_hold(&xdst->u.dst); in xfrm_lookup()
2250 xdst->u.dst.flags |= DST_NOCACHE; in xfrm_lookup()
2282 dst = &xdst->u.dst; in xfrm_lookup()
2325 dst_release(dst); in xfrm_lookup()
2326 dst = dst_orig; in xfrm_lookup()
2330 if (dst && dst->xfrm && in xfrm_lookup()
2331 dst->xfrm->props.mode == XFRM_MODE_TUNNEL) in xfrm_lookup()
2332 dst->flags |= DST_XFRM_TUNNEL; in xfrm_lookup()
2333 return dst; in xfrm_lookup()
2337 dst = dst_orig; in xfrm_lookup()
2342 dst_release(dst); in xfrm_lookup()
2358 struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, in xfrm_lookup_route() local
2362 if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) in xfrm_lookup_route()
2365 return dst; in xfrm_lookup_route()
2625 struct dst_entry *dst; in __xfrm_route_forward() local
2635 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE); in __xfrm_route_forward()
2636 if (IS_ERR(dst)) { in __xfrm_route_forward()
2638 dst = NULL; in __xfrm_route_forward()
2640 skb_dst_set(skb, dst); in __xfrm_route_forward()
2647 static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie) in xfrm_dst_check() argument
2670 if (dst->obsolete < 0 && !stale_bundle(dst)) in xfrm_dst_check()
2671 return dst; in xfrm_dst_check()
2676 static int stale_bundle(struct dst_entry *dst) in stale_bundle() argument
2678 return !xfrm_bundle_ok((struct xfrm_dst *)dst); in stale_bundle()
2681 void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) in xfrm_dst_ifdown() argument
2683 while ((dst = dst->child) && dst->xfrm && dst->dev == dev) { in xfrm_dst_ifdown()
2684 dst->dev = dev_net(dev)->loopback_dev; in xfrm_dst_ifdown()
2685 dev_hold(dst->dev); in xfrm_dst_ifdown()
2696 static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst) in xfrm_negative_advice() argument
2698 if (dst) { in xfrm_negative_advice()
2699 if (dst->obsolete) { in xfrm_negative_advice()
2700 dst_release(dst); in xfrm_negative_advice()
2701 dst = NULL; in xfrm_negative_advice()
2704 return dst; in xfrm_negative_advice()
2718 static void xfrm_init_pmtu(struct dst_entry *dst) in xfrm_init_pmtu() argument
2721 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_init_pmtu()
2724 pmtu = dst_mtu(dst->child); in xfrm_init_pmtu()
2727 pmtu = xfrm_state_mtu(dst->xfrm, pmtu); in xfrm_init_pmtu()
2735 dst_metric_set(dst, RTAX_MTU, pmtu); in xfrm_init_pmtu()
2736 } while ((dst = dst->next)); in xfrm_init_pmtu()
2745 struct dst_entry *dst = &first->u.dst; in xfrm_bundle_ok() local
2749 if (!dst_check(dst->path, ((struct xfrm_dst *)dst)->path_cookie) || in xfrm_bundle_ok()
2750 (dst->dev && !netif_running(dst->dev))) in xfrm_bundle_ok()
2753 if (dst->flags & DST_XFRM_QUEUE) in xfrm_bundle_ok()
2759 struct xfrm_dst *xdst = (struct xfrm_dst *)dst; in xfrm_bundle_ok()
2761 if (dst->xfrm->km.state != XFRM_STATE_VALID) in xfrm_bundle_ok()
2763 if (xdst->xfrm_genid != dst->xfrm->genid) in xfrm_bundle_ok()
2769 mtu = dst_mtu(dst->child); in xfrm_bundle_ok()
2783 dst = dst->child; in xfrm_bundle_ok()
2784 } while (dst->xfrm); in xfrm_bundle_ok()
2791 dst = &last->u.dst; in xfrm_bundle_ok()
2793 mtu = xfrm_state_mtu(dst->xfrm, mtu); in xfrm_bundle_ok()
2796 dst_metric_set(dst, RTAX_MTU, mtu); in xfrm_bundle_ok()
2801 last = (struct xfrm_dst *)last->u.dst.next; in xfrm_bundle_ok()
2808 static unsigned int xfrm_default_advmss(const struct dst_entry *dst) in xfrm_default_advmss() argument
2810 return dst_metric_advmss(dst->path); in xfrm_default_advmss()
2813 static unsigned int xfrm_mtu(const struct dst_entry *dst) in xfrm_mtu() argument
2815 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); in xfrm_mtu()
2817 return mtu ? : dst_mtu(dst->path); in xfrm_mtu()
2820 static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, in xfrm_neigh_lookup() argument
2824 return dst->path->ops->neigh_lookup(dst, skb, daddr); in xfrm_neigh_lookup()