aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/mip6.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-29 06:54:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-29 06:54:01 -0500
commit0ba6c33bcddc64a54b5f1c25a696c4767dc76292 (patch)
tree62e616f97a4762d8e75bf732e4827af2d15d52c5 /net/ipv6/mip6.c
parent21af0297c7e56024a5ccc4d8ad2a590f9ec371ba (diff)
parent85040bcb4643cba578839e953f25e2d1965d83d0 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25: (1470 commits) [IPV6] ADDRLABEL: Fix double free on label deletion. [PPP]: Sparse warning fixes. [IPV4] fib_trie: remove unneeded NULL check [IPV4] fib_trie: More whitespace cleanup. [NET_SCHED]: Use nla_policy for attribute validation in ematches [NET_SCHED]: Use nla_policy for attribute validation in actions [NET_SCHED]: Use nla_policy for attribute validation in classifiers [NET_SCHED]: Use nla_policy for attribute validation in packet schedulers [NET_SCHED]: sch_api: introduce constant for rate table size [NET_SCHED]: Use typeful attribute parsing helpers [NET_SCHED]: Use typeful attribute construction helpers [NET_SCHED]: Use NLA_PUT_STRING for string dumping [NET_SCHED]: Use nla_nest_start/nla_nest_end [NET_SCHED]: Propagate nla_parse return value [NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get [NET_SCHED]: act_api: use nlmsg_parse [NET_SCHED]: act_api: fix netlink API conversion bug [NET_SCHED]: sch_netem: use nla_parse_nested_compat [NET_SCHED]: sch_atm: fix format string warning [NETNS]: Add namespace for ICMP replying code. ...
Diffstat (limited to 'net/ipv6/mip6.c')
-rw-r--r--net/ipv6/mip6.c25
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
37static xfrm_address_t *mip6_xfrm_addr(struct xfrm_state *x, xfrm_address_t *addr)
38{
39 return x->coaddr;
40}
41
42static inline unsigned int calc_padlen(unsigned int len, unsigned int n) 37static 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
350static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) 347static 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
479static int __init mip6_init(void) 478static int __init mip6_init(void)