diff options
Diffstat (limited to 'net/ipv6/mip6.c')
-rw-r--r-- | net/ipv6/mip6.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 7fd841d41019..49d396620eac 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; |
@@ -133,12 +128,15 @@ static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb) | |||
133 | { | 128 | { |
134 | struct ipv6hdr *iph = ipv6_hdr(skb); | 129 | struct ipv6hdr *iph = ipv6_hdr(skb); |
135 | struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; | 130 | struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; |
131 | int err = destopt->nexthdr; | ||
136 | 132 | ||
133 | spin_lock(&x->lock); | ||
137 | if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) && | 134 | if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) && |
138 | !ipv6_addr_any((struct in6_addr *)x->coaddr)) | 135 | !ipv6_addr_any((struct in6_addr *)x->coaddr)) |
139 | return -ENOENT; | 136 | err = -ENOENT; |
137 | spin_unlock(&x->lock); | ||
140 | 138 | ||
141 | return destopt->nexthdr; | 139 | return err; |
142 | } | 140 | } |
143 | 141 | ||
144 | /* Destination Option Header is inserted. | 142 | /* Destination Option Header is inserted. |
@@ -337,25 +335,27 @@ static struct xfrm_type mip6_destopt_type = | |||
337 | .description = "MIP6DESTOPT", | 335 | .description = "MIP6DESTOPT", |
338 | .owner = THIS_MODULE, | 336 | .owner = THIS_MODULE, |
339 | .proto = IPPROTO_DSTOPTS, | 337 | .proto = IPPROTO_DSTOPTS, |
340 | .flags = XFRM_TYPE_NON_FRAGMENT, | 338 | .flags = XFRM_TYPE_NON_FRAGMENT | XFRM_TYPE_LOCAL_COADDR, |
341 | .init_state = mip6_destopt_init_state, | 339 | .init_state = mip6_destopt_init_state, |
342 | .destructor = mip6_destopt_destroy, | 340 | .destructor = mip6_destopt_destroy, |
343 | .input = mip6_destopt_input, | 341 | .input = mip6_destopt_input, |
344 | .output = mip6_destopt_output, | 342 | .output = mip6_destopt_output, |
345 | .reject = mip6_destopt_reject, | 343 | .reject = mip6_destopt_reject, |
346 | .hdr_offset = mip6_destopt_offset, | 344 | .hdr_offset = mip6_destopt_offset, |
347 | .local_addr = mip6_xfrm_addr, | ||
348 | }; | 345 | }; |
349 | 346 | ||
350 | static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) | 347 | static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) |
351 | { | 348 | { |
352 | struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; | 349 | struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; |
350 | int err = rt2->rt_hdr.nexthdr; | ||
353 | 351 | ||
352 | spin_lock(&x->lock); | ||
354 | if (!ipv6_addr_equal(&rt2->addr, (struct in6_addr *)x->coaddr) && | 353 | if (!ipv6_addr_equal(&rt2->addr, (struct in6_addr *)x->coaddr) && |
355 | !ipv6_addr_any((struct in6_addr *)x->coaddr)) | 354 | !ipv6_addr_any((struct in6_addr *)x->coaddr)) |
356 | return -ENOENT; | 355 | err = -ENOENT; |
356 | spin_unlock(&x->lock); | ||
357 | 357 | ||
358 | return rt2->rt_hdr.nexthdr; | 358 | return err; |
359 | } | 359 | } |
360 | 360 | ||
361 | /* Routing Header type 2 is inserted. | 361 | /* Routing Header type 2 is inserted. |
@@ -467,13 +467,12 @@ static struct xfrm_type mip6_rthdr_type = | |||
467 | .description = "MIP6RT", | 467 | .description = "MIP6RT", |
468 | .owner = THIS_MODULE, | 468 | .owner = THIS_MODULE, |
469 | .proto = IPPROTO_ROUTING, | 469 | .proto = IPPROTO_ROUTING, |
470 | .flags = XFRM_TYPE_NON_FRAGMENT, | 470 | .flags = XFRM_TYPE_NON_FRAGMENT | XFRM_TYPE_REMOTE_COADDR, |
471 | .init_state = mip6_rthdr_init_state, | 471 | .init_state = mip6_rthdr_init_state, |
472 | .destructor = mip6_rthdr_destroy, | 472 | .destructor = mip6_rthdr_destroy, |
473 | .input = mip6_rthdr_input, | 473 | .input = mip6_rthdr_input, |
474 | .output = mip6_rthdr_output, | 474 | .output = mip6_rthdr_output, |
475 | .hdr_offset = mip6_rthdr_offset, | 475 | .hdr_offset = mip6_rthdr_offset, |
476 | .remote_addr = mip6_xfrm_addr, | ||
477 | }; | 476 | }; |
478 | 477 | ||
479 | static int __init mip6_init(void) | 478 | static int __init mip6_init(void) |