2 * Mobile IPv6 Mobile Node Module
5 * Sami Kivisaari <skivisaa@cc.hut.fi>
6 * Antti Tuominen <ajtuomin@tml.hut.fi>
8 * $Id: s.module_mn.c 1.33 03/09/22 16:45:04+03:00 vnuorval@amber.hut.mediapoli.com $
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.
16 #include <linux/config.h>
17 #include <linux/module.h>
18 #include <linux/init.h>
21 #include <linux/sysctl.h>
22 #endif /* CONFIG_SYSCTL */
24 #include <net/mipglue.h>
25 #include <net/ipv6_tunnel.h>
27 extern int mipv6_debug;
28 int mipv6_use_auth = 0;
31 // && LINUX_VERSION_CODE > 0
32 MODULE_AUTHOR("MIPL Team");
33 MODULE_DESCRIPTION("Mobile IPv6 Mobile Node");
34 MODULE_LICENSE("GPL");
35 //MODULE_PARM(mipv6_debug, "i");
42 #include "mipv6_icmp.h"
45 /* TODO: These will go as soon as we get rid of the last two ioctls */
46 extern int mipv6_ioctl_mn_init(void);
47 extern void mipv6_ioctl_mn_exit(void);
49 /**********************************************************************
51 * MIPv6 Module Init / Cleanup
53 **********************************************************************/
58 extern int max_rtr_reach_time;
59 extern int eager_cell_switching;
61 static int max_reach = 1000;
62 static int min_reach = 1;
63 static int max_one = 1;
64 static int min_zero = 0;
67 mipv6_mdetect_mech_sysctl(ctl_table *, int, struct file *, void *, size_t *);
70 mipv6_router_reach_sysctl(ctl_table *, int, struct file *, void *, size_t *);
73 ctl_table mipv6_mobility_table[] = {
74 {NET_IPV6_MOBILITY_BU_F_LLADDR, "bu_flag_lladdr",
75 &mip6node_cnf.bu_lladdr, sizeof(int), 0644, NULL,
76 &proc_dointvec_minmax, &sysctl_intvec, 0, &min_zero, &max_one},
77 {NET_IPV6_MOBILITY_BU_F_KEYMGM, "bu_flag_keymgm",
78 &mip6node_cnf.bu_keymgm, sizeof(int), 0644, NULL,
79 &proc_dointvec_minmax, &sysctl_intvec, 0, &min_zero, &max_one},
80 {NET_IPV6_MOBILITY_BU_F_CN_ACK, "bu_flag_cn_ack",
81 &mip6node_cnf.bu_cn_ack, sizeof(int), 0644, NULL,
82 &proc_dointvec_minmax, &sysctl_intvec, 0, &min_zero, &max_one},
84 {NET_IPV6_MOBILITY_ROUTER_REACH, "max_router_reachable_time",
85 &max_rtr_reach_time, sizeof(int), 0644, NULL,
86 &proc_dointvec_minmax, &sysctl_intvec, 0, &min_reach, &max_reach},
88 {NET_IPV6_MOBILITY_MDETECT_MECHANISM, "eager_cell_switching",
89 &eager_cell_switching, sizeof(int), 0644, NULL,
90 &proc_dointvec_minmax, &sysctl_intvec, 0, &min_zero, &max_one},
94 ctl_table mipv6_table[] = {
95 {NET_IPV6_MOBILITY, "mobility", NULL, 0, 0555, mipv6_mobility_table},
99 static struct ctl_table_header *mipv6_sysctl_header;
100 static struct ctl_table mipv6_net_table[];
101 static struct ctl_table mipv6_root_table[];
103 ctl_table mipv6_net_table[] = {
104 {NET_IPV6, "ipv6", NULL, 0, 0555, mipv6_table},
108 ctl_table mipv6_root_table[] = {
109 {CTL_NET, "net", NULL, 0, 0555, mipv6_net_table},
112 #endif /* CONFIG_SYSCTL */
114 /* Initialize the module */
115 static int __init mip6_mn_init(void)
118 extern int mipv6_initialize_pfx_icmpv6(void);
120 printk(KERN_INFO "MIPL Mobile IPv6 for Linux Mobile Node %s (%s)\n",
121 MIPLVERSION, MIPV6VERSION);
122 mip6node_cnf.capabilities = CAP_CN | CAP_MN;
124 #ifdef CONFIG_IPV6_MOBILITY_DEBUG
125 printk(KERN_INFO "Debug-level: %d\n", mipv6_debug);
129 mipv6_sysctl_header = register_sysctl_table(mipv6_root_table, 0);
131 if ((err = mipv6_mn_init()) < 0)
136 mip6_fn.icmpv6_dhaad_rep_rcv = mipv6_icmpv6_rcv_dhaad_rep;
137 mip6_fn.icmpv6_dhaad_req_rcv = mipv6_icmpv6_no_rcv;
138 mip6_fn.icmpv6_pfxadv_rcv = mipv6_icmpv6_rcv_pfx_adv;
139 mip6_fn.icmpv6_pfxsol_rcv = mipv6_icmpv6_no_rcv;
140 mip6_fn.icmpv6_paramprob_rcv = mipv6_icmpv6_rcv_paramprob;
142 mipv6_initialize_pfx_icmpv6();
144 if ((err = mipv6_ioctl_mn_init()) < 0)
150 mipv6_shutdown_pfx_icmpv6();
152 mip6_fn.icmpv6_dhaad_rep_rcv = NULL;
153 mip6_fn.icmpv6_dhaad_req_rcv = NULL;
154 mip6_fn.icmpv6_pfxadv_rcv = NULL;
155 mip6_fn.icmpv6_pfxsol_rcv = NULL;
156 mip6_fn.icmpv6_paramprob_rcv = NULL;
162 unregister_sysctl_table(mipv6_sysctl_header);
166 module_init(mip6_mn_init);
170 static void __exit mip6_mn_exit(void)
172 printk(KERN_INFO "mip6_mn.o exiting.\n");
173 mip6node_cnf.capabilities &= ~(int)CAP_MN;
175 mipv6_ioctl_mn_exit();
176 mipv6_shutdown_pfx_icmpv6();
178 mip6_fn.icmpv6_dhaad_rep_rcv = NULL;
179 mip6_fn.icmpv6_dhaad_req_rcv = NULL;
180 mip6_fn.icmpv6_pfxadv_rcv = NULL;
181 mip6_fn.icmpv6_pfxsol_rcv = NULL;
182 mip6_fn.icmpv6_paramprob_rcv = NULL;
188 unregister_sysctl_table(mipv6_sysctl_header);
191 module_exit(mip6_mn_exit);