diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/mip6.c | 11 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 20 |
2 files changed, 10 insertions, 21 deletions
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 7fd841d41019..edfd9cdd721c 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -34,11 +34,6 @@ | |||
34 | #include <net/xfrm.h> | 34 | #include <net/xfrm.h> |
35 | #include <net/mip6.h> | 35 | #include <net/mip6.h> |
36 | 36 | ||
37 | static xfrm_address_t *mip6_xfrm_addr(struct xfrm_state *x, xfrm_address_t *addr) | ||
38 | { | ||
39 | return x->coaddr; | ||
40 | } | ||
41 | |||
42 | static inline unsigned int calc_padlen(unsigned int len, unsigned int n) | 37 | static inline unsigned int calc_padlen(unsigned int len, unsigned int n) |
43 | { | 38 | { |
44 | return (n - len + 16) & 0x7; | 39 | return (n - len + 16) & 0x7; |
@@ -337,14 +332,13 @@ static struct xfrm_type mip6_destopt_type = | |||
337 | .description = "MIP6DESTOPT", | 332 | .description = "MIP6DESTOPT", |
338 | .owner = THIS_MODULE, | 333 | .owner = THIS_MODULE, |
339 | .proto = IPPROTO_DSTOPTS, | 334 | .proto = IPPROTO_DSTOPTS, |
340 | .flags = XFRM_TYPE_NON_FRAGMENT, | 335 | .flags = XFRM_TYPE_NON_FRAGMENT | XFRM_TYPE_LOCAL_COADDR, |
341 | .init_state = mip6_destopt_init_state, | 336 | .init_state = mip6_destopt_init_state, |
342 | .destructor = mip6_destopt_destroy, | 337 | .destructor = mip6_destopt_destroy, |
343 | .input = mip6_destopt_input, | 338 | .input = mip6_destopt_input, |
344 | .output = mip6_destopt_output, | 339 | .output = mip6_destopt_output, |
345 | .reject = mip6_destopt_reject, | 340 | .reject = mip6_destopt_reject, |
346 | .hdr_offset = mip6_destopt_offset, | 341 | .hdr_offset = mip6_destopt_offset, |
347 | .local_addr = mip6_xfrm_addr, | ||
348 | }; | 342 | }; |
349 | 343 | ||
350 | static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) | 344 | static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) |
@@ -467,13 +461,12 @@ static struct xfrm_type mip6_rthdr_type = | |||
467 | .description = "MIP6RT", | 461 | .description = "MIP6RT", |
468 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
469 | .proto = IPPROTO_ROUTING, | 463 | .proto = IPPROTO_ROUTING, |
470 | .flags = XFRM_TYPE_NON_FRAGMENT, | 464 | .flags = XFRM_TYPE_NON_FRAGMENT | XFRM_TYPE_REMOTE_COADDR, |
471 | .init_state = mip6_rthdr_init_state, | 465 | .init_state = mip6_rthdr_init_state, |
472 | .destructor = mip6_rthdr_destroy, | 466 | .destructor = mip6_rthdr_destroy, |
473 | .input = mip6_rthdr_input, | 467 | .input = mip6_rthdr_input, |
474 | .output = mip6_rthdr_output, | 468 | .output = mip6_rthdr_output, |
475 | .hdr_offset = mip6_rthdr_offset, | 469 | .hdr_offset = mip6_rthdr_offset, |
476 | .remote_addr = mip6_xfrm_addr, | ||
477 | }; | 470 | }; |
478 | 471 | ||
479 | static int __init mip6_init(void) | 472 | static int __init mip6_init(void) |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 77dc3651437e..3b38e493d151 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -87,20 +87,16 @@ __xfrm6_find_bundle(struct flowi *fl, struct xfrm_policy *policy) | |||
87 | return dst; | 87 | return dst; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline struct in6_addr* | 90 | static inline xfrm_address_t *__xfrm6_bundle_addr_remote(struct xfrm_state *x) |
91 | __xfrm6_bundle_addr_remote(struct xfrm_state *x, struct in6_addr *addr) | ||
92 | { | 91 | { |
93 | return (x->type->remote_addr) ? | 92 | return (x->type->flags & XFRM_TYPE_REMOTE_COADDR) ? x->coaddr : |
94 | (struct in6_addr*)x->type->remote_addr(x, (xfrm_address_t *)addr) : | 93 | &x->id.daddr; |
95 | (struct in6_addr*)&x->id.daddr; | ||
96 | } | 94 | } |
97 | 95 | ||
98 | static inline struct in6_addr* | 96 | static inline xfrm_address_t *__xfrm6_bundle_addr_local(struct xfrm_state *x) |
99 | __xfrm6_bundle_addr_local(struct xfrm_state *x, struct in6_addr *addr) | ||
100 | { | 97 | { |
101 | return (x->type->local_addr) ? | 98 | return (x->type->flags & XFRM_TYPE_LOCAL_COADDR) ? x->coaddr : |
102 | (struct in6_addr*)x->type->local_addr(x, (xfrm_address_t *)addr) : | 99 | &x->props.saddr; |
103 | (struct in6_addr*)&x->props.saddr; | ||
104 | } | 100 | } |
105 | 101 | ||
106 | /* Allocate chain of dst_entry's, attach known xfrm's, calculate | 102 | /* Allocate chain of dst_entry's, attach known xfrm's, calculate |
@@ -171,9 +167,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
171 | fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; | 167 | fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; |
172 | break; | 168 | break; |
173 | case AF_INET6: | 169 | case AF_INET6: |
174 | ipv6_addr_copy(&fl_tunnel.fl6_dst, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_dst)); | 170 | ipv6_addr_copy(&fl_tunnel.fl6_dst, (struct in6_addr *)__xfrm6_bundle_addr_remote(xfrm[i])); |
175 | 171 | ||
176 | ipv6_addr_copy(&fl_tunnel.fl6_src, __xfrm6_bundle_addr_local(xfrm[i], &fl->fl6_src)); | 172 | ipv6_addr_copy(&fl_tunnel.fl6_src, (struct in6_addr *)__xfrm6_bundle_addr_local(xfrm[i])); |
177 | break; | 173 | break; |
178 | default: | 174 | default: |
179 | BUG_ON(1); | 175 | BUG_ON(1); |