Two swsusp patches:
[linux-flexiantxendom0-3.2.10.git] / net / ipv6 / mipglue.c
1 /*
2  *      Glue for Mobility support integration to IPv6
3  *
4  *      Authors:
5  *      Antti Tuominen          <ajtuomin@cc.hut.fi>    
6  *
7  *      $Id: s.mipglue.c 1.7 03/09/18 15:59:41+03:00 vnuorval@amber.hut.mediapoli.com $
8  *
9  *      This program is free software; you can redistribute it and/or
10  *      modify it under the terms of the GNU General Public License
11  *      as published by the Free Software Foundation; either version
12  *      2 of the License, or (at your option) any later version.
13  *
14  */
15
16 #include <linux/sched.h>
17
18 #include <net/ipv6.h>
19 #include <net/addrconf.h>
20 #include <net/neighbour.h>
21 #include <net/mipglue.h>
22
23 extern int ip6_tlvopt_unknown(struct sk_buff *skb, int optoff);
24
25 /*  Initialize all zero  */
26 struct mipv6_callable_functions mipv6_functions = { NULL };
27
28 /* Sets mipv6_functions struct to zero to invalidate all successive
29  * calls to mipv6 functions. Used on module unload. */
30
31 void mipv6_invalidate_calls(void)
32 {
33         memset(&mipv6_functions, 0, sizeof(mipv6_functions));
34 }
35
36
37 /* Selects correct handler for tlv encoded destination option. Called
38  * by ip6_parse_tlv. Checks if mipv6 calls are valid before calling. */
39
40 int mipv6_handle_dstopt(struct sk_buff *skb, int optoff)
41 {
42         int ret;
43
44         switch (skb->nh.raw[optoff]) {
45         case MIPV6_TLV_HOMEADDR: 
46                 ret = MIPV6_CALLFUNC(mipv6_handle_homeaddr, 0)(skb, optoff);
47                 break;
48         default:
49                 /* Should never happen */
50                 printk(KERN_ERR __FILE__ ": Invalid destination option code (%d)\n",
51                        skb->nh.raw[optoff]);
52                 ret = 1;
53                 break;
54         }
55
56         /* If mipv6 handlers are not valid, pass the packet to
57          * ip6_tlvopt_unknown() for correct handling. */
58         if (!ret)
59                 return ip6_tlvopt_unknown(skb, optoff);
60
61         return ret;
62 }
63
64 EXPORT_SYMBOL(mipv6_functions);
65 EXPORT_SYMBOL(mipv6_invalidate_calls);