Two swsusp patches:
[linux-flexiantxendom0-3.2.10.git] / net / ipv6 / mobile_ip6 / module_cn.c
1 /*
2  *      Mobile IPv6 Common Module
3  *
4  *      Authors:
5  *      Sami Kivisaari          <skivisaa@cc.hut.fi>
6  *      Antti Tuominen          <ajtuomin@tml.hut.fi>
7  *
8  *      $Id: s.module_cn.c 1.15 03/08/26 12:07:40+03:00 henkku@tcs-pc-5.tcs.hut.fi $
9  *
10  *      This program is free software; you can redistribute it and/or
11  *      modify it under the terms of the GNU General Public License
12  *      as published by the Free Software Foundation; either version
13  *      2 of the License, or (at your option) any later version.
14  */
15
16 #include <linux/config.h>
17 #include <linux/module.h>
18 #include <linux/init.h>
19
20 #ifdef CONFIG_SYSCTL
21 #include <linux/sysctl.h>
22 #endif /* CONFIG_SYSCTL */
23
24 #include <net/mipglue.h>
25
26 #include "bcache.h"
27 #include "mipv6_icmp.h"
28 #include "stats.h"
29 #include "mobhdr.h"
30 #include "exthdrs.h"
31 #include <net/ipv6_tunnel.h>
32
33 int mipv6_debug = 1;
34
35 #if defined(MODULE)
36 //&& LINUX_VERSION_CODE > 0
37 MODULE_AUTHOR("MIPL Team");
38 MODULE_DESCRIPTION("Mobile IPv6");
39 MODULE_LICENSE("GPL");
40 MODULE_PARM(mipv6_debug, "i");
41 #endif
42
43 #include "config.h"
44
45 struct mip6_func mip6_fn;
46 struct mip6_conf mip6node_cnf = {
47         capabilities:           CAP_CN,
48         accept_ret_rout:        1,
49         max_rtr_reachable_time: 0,
50         eager_cell_switching:   0,
51         max_num_tunnels:        0,
52         min_num_tunnels:        0,
53         binding_refresh_advice: 0,
54         bu_lladdr:              0,
55         bu_keymgm:              0,
56         bu_cn_ack:              0
57 };
58
59 #define MIPV6_BCACHE_SIZE 128
60
61 /**********************************************************************
62  *
63  * MIPv6 CN Module Init / Cleanup
64  *
65  **********************************************************************/
66
67 #ifdef CONFIG_SYSCTL
68 /* Sysctl table */
69 ctl_table mipv6_mobility_table[] = {
70         {NET_IPV6_MOBILITY_DEBUG, "debuglevel",
71          &mipv6_debug, sizeof(int), 0644, NULL,
72          &proc_dointvec},
73         {NET_IPV6_MOBILITY_RETROUT, "accept_return_routability",
74          &mip6node_cnf.accept_ret_rout, sizeof(int), 0644, NULL,
75          &proc_dointvec},
76         {0}
77 };
78 ctl_table mipv6_table[] = {
79         {NET_IPV6_MOBILITY, "mobility", NULL, 0, 0555, mipv6_mobility_table},
80         {0}
81 };
82
83 static struct ctl_table_header *mipv6_sysctl_header;
84 static struct ctl_table mipv6_net_table[];
85 static struct ctl_table mipv6_root_table[];
86
87 ctl_table mipv6_net_table[] = {
88         {NET_IPV6, "ipv6", NULL, 0, 0555, mipv6_table},
89         {0}
90 };
91
92 ctl_table mipv6_root_table[] = {
93         {CTL_NET, "net", NULL, 0, 0555, mipv6_net_table},
94         {0}
95 };
96 #endif /* CONFIG_SYSCTL */
97
98 extern void mipv6_rr_init(void);
99
100 /*  Initialize the module  */
101 static int __init mip6_init(void)
102 {
103         int err = 0;
104
105         printk(KERN_INFO "MIPL Mobile IPv6 for Linux Correspondent Node %s (%s)\n",
106                MIPLVERSION, MIPV6VERSION);
107
108 #ifdef CONFIG_IPV6_MOBILITY_DEBUG
109         printk(KERN_INFO "Debug-level: %d\n", mipv6_debug);
110 #endif
111
112         if ((err = mipv6_bcache_init(MIPV6_BCACHE_SIZE)) < 0)
113                 goto bcache_fail;
114
115         if ((err = mipv6_icmpv6_init()) < 0)
116                 goto icmp_fail;
117
118         if ((err = mipv6_stats_init()) < 0)
119                 goto stats_fail;
120         mipv6_rr_init();
121
122 #ifdef CONFIG_SYSCTL
123         mipv6_sysctl_header = register_sysctl_table(mipv6_root_table, 0);
124 #endif
125
126         if ((err = mipv6_mh_common_init()) < 0)
127                 goto mh_fail;
128
129         MIPV6_SETCALL(mipv6_modify_txoptions, mipv6_modify_txoptions);
130                 
131         MIPV6_SETCALL(mipv6_handle_homeaddr, mipv6_handle_homeaddr);
132         MIPV6_SETCALL(mipv6_icmp_handle_homeaddr, mipv6_icmp_handle_homeaddr);
133
134         return 0;
135
136 mh_fail:
137 #ifdef CONFIG_SYSCTL
138         unregister_sysctl_table(mipv6_sysctl_header);
139 #endif
140         mipv6_stats_exit();
141 stats_fail:
142         mipv6_icmpv6_exit();
143 icmp_fail:
144         mipv6_bcache_exit();
145 bcache_fail:
146         return err;
147 }
148 module_init(mip6_init);
149
150 #ifdef MODULE
151 /*  Cleanup module  */
152 static void __exit mip6_exit(void)
153 {
154         printk(KERN_INFO "mip6_base.o exiting.\n");
155 #ifdef CONFIG_SYSCTL
156         unregister_sysctl_table(mipv6_sysctl_header);
157 #endif
158
159         /* Invalidate all custom kernel hooks.  No need to do this
160            separately for all hooks. */
161         mipv6_invalidate_calls();
162
163         mipv6_mh_common_exit();
164         mipv6_stats_exit();
165         mipv6_icmpv6_exit();
166         mipv6_bcache_exit();
167 }
168 module_exit(mip6_exit);
169 #endif /* MODULE */
170
171 EXPORT_SYMBOL(mipv6_debug);
172 EXPORT_SYMBOL(mip6node_cnf);
173 EXPORT_SYMBOL(mip6_fn);