diff options
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index df5bfa837eb3..085c19d4d1b7 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/err.h> | ||
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
17 | #include <linux/kmod.h> | 18 | #include <linux/kmod.h> |
18 | #include <linux/list.h> | 19 | #include <linux/list.h> |
@@ -84,21 +85,25 @@ int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, | |||
84 | return 0; | 85 | return 0; |
85 | } | 86 | } |
86 | 87 | ||
87 | int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, | 88 | struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x, int tos) |
88 | unsigned short family) | ||
89 | { | 89 | { |
90 | struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family); | 90 | xfrm_address_t *saddr = &x->props.saddr; |
91 | int err = 0; | 91 | xfrm_address_t *daddr = &x->id.daddr; |
92 | struct xfrm_policy_afinfo *afinfo; | ||
93 | struct dst_entry *dst; | ||
92 | 94 | ||
95 | if (x->type->flags & XFRM_TYPE_LOCAL_COADDR) | ||
96 | saddr = x->coaddr; | ||
97 | if (x->type->flags & XFRM_TYPE_REMOTE_COADDR) | ||
98 | daddr = x->coaddr; | ||
99 | |||
100 | afinfo = xfrm_policy_get_afinfo(x->props.family); | ||
93 | if (unlikely(afinfo == NULL)) | 101 | if (unlikely(afinfo == NULL)) |
94 | return -EAFNOSUPPORT; | 102 | return ERR_PTR(-EAFNOSUPPORT); |
95 | 103 | ||
96 | if (likely(afinfo->dst_lookup != NULL)) | 104 | dst = afinfo->dst_lookup(tos, saddr, daddr); |
97 | err = afinfo->dst_lookup(dst, fl); | ||
98 | else | ||
99 | err = -EINVAL; | ||
100 | xfrm_policy_put_afinfo(afinfo); | 105 | xfrm_policy_put_afinfo(afinfo); |
101 | return err; | 106 | return dst; |
102 | } | 107 | } |
103 | EXPORT_SYMBOL(xfrm_dst_lookup); | 108 | EXPORT_SYMBOL(xfrm_dst_lookup); |
104 | 109 | ||