|
@@ -1797,43 +1797,6 @@ free_dst:
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_XFRM_SUB_POLICY
|
|
|
-static int xfrm_dst_alloc_copy(void **target, const void *src, int size)
|
|
|
-{
|
|
|
- if (!*target) {
|
|
|
- *target = kmalloc(size, GFP_ATOMIC);
|
|
|
- if (!*target)
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
-
|
|
|
- memcpy(*target, src, size);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-static int xfrm_dst_update_parent(struct dst_entry *dst,
|
|
|
- const struct xfrm_selector *sel)
|
|
|
-{
|
|
|
-#ifdef CONFIG_XFRM_SUB_POLICY
|
|
|
- struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
|
|
|
- return xfrm_dst_alloc_copy((void **)&(xdst->partner),
|
|
|
- sel, sizeof(*sel));
|
|
|
-#else
|
|
|
- return 0;
|
|
|
-#endif
|
|
|
-}
|
|
|
-
|
|
|
-static int xfrm_dst_update_origin(struct dst_entry *dst,
|
|
|
- const struct flowi *fl)
|
|
|
-{
|
|
|
-#ifdef CONFIG_XFRM_SUB_POLICY
|
|
|
- struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
|
|
|
- return xfrm_dst_alloc_copy((void **)&(xdst->origin), fl, sizeof(*fl));
|
|
|
-#else
|
|
|
- return 0;
|
|
|
-#endif
|
|
|
-}
|
|
|
-
|
|
|
static int xfrm_expand_policies(const struct flowi *fl, u16 family,
|
|
|
struct xfrm_policy **pols,
|
|
|
int *num_pols, int *num_xfrms)
|
|
@@ -1905,16 +1868,6 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
|
|
|
|
|
|
xdst = (struct xfrm_dst *)dst;
|
|
|
xdst->num_xfrms = err;
|
|
|
- if (num_pols > 1)
|
|
|
- err = xfrm_dst_update_parent(dst, &pols[1]->selector);
|
|
|
- else
|
|
|
- err = xfrm_dst_update_origin(dst, fl);
|
|
|
- if (unlikely(err)) {
|
|
|
- dst_free(dst);
|
|
|
- XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTBUNDLECHECKERROR);
|
|
|
- return ERR_PTR(err);
|
|
|
- }
|
|
|
-
|
|
|
xdst->num_pols = num_pols;
|
|
|
memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols);
|
|
|
xdst->policy_genid = atomic_read(&pols[0]->genid);
|