pf_lana: release lock in sendmsg after ppe has finished
[ana-net.git] / src / core.c
blob86f4cafb36a73881a2f80c3d99a407e8b2fac801
1 /*
2 * Lightweight Autonomic Network Architecture
4 * Collector and loader for all core extensions (xt_*).
6 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
7 * Swiss federal institute of technology (ETH Zurich)
8 * Subject to the GPL.
9 */
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/proc_fs.h>
14 #include <net/net_namespace.h>
16 #include "xt_fblock.h"
17 #include "xt_vlink.h"
18 #include "xt_builder.h"
19 #include "xt_user.h"
20 #include "xt_engine.h"
22 struct proc_dir_entry *lana_proc_dir;
23 EXPORT_SYMBOL(lana_proc_dir);
24 struct proc_dir_entry *fblock_proc_dir;
25 EXPORT_SYMBOL(fblock_proc_dir);
27 static int __init init_lana_core_module(void)
29 int ret;
31 printk(KERN_INFO "[lana] bootstrapping core ...\n");
33 lana_proc_dir = proc_mkdir("lana", init_net.proc_net);
34 if (!lana_proc_dir)
35 return -ENOMEM;
36 fblock_proc_dir = proc_mkdir("fblock", lana_proc_dir);
37 if (!fblock_proc_dir)
38 goto err;
39 ret = init_vlink_system();
40 if (ret)
41 goto err1;
42 ret = init_fblock_tables();
43 if (ret)
44 goto err2;
45 ret = init_fblock_builder();
46 if (ret)
47 goto err3;
48 ret = init_userctl_system();
49 if (ret)
50 goto err4;
51 ret = init_engine();
52 if (ret)
53 goto err5;
55 printk(KERN_INFO "[lana] core up and running!\n");
56 return 0;
57 err5:
58 cleanup_userctl_system();
59 err4:
60 cleanup_fblock_builder();
61 err3:
62 cleanup_fblock_tables();
63 err2:
64 cleanup_vlink_system();
65 err1:
66 remove_proc_entry("fblock", lana_proc_dir);
67 err:
68 remove_proc_entry("lana", init_net.proc_net);
69 return -ENOMEM;
72 static void __exit cleanup_lana_core_module(void)
74 printk(KERN_INFO "[lana] halting core ...\n");
76 cleanup_userctl_system();
77 cleanup_fblock_tables();
78 cleanup_fblock_builder();
79 cleanup_vlink_system();
80 cleanup_engine();
81 remove_proc_entry("fblock", lana_proc_dir);
82 remove_proc_entry("lana", init_net.proc_net);
84 printk(KERN_INFO "[lana] core shut down!\n");
87 module_init(init_lana_core_module);
88 module_exit(cleanup_lana_core_module);
90 MODULE_LICENSE("GPL");
91 MODULE_AUTHOR("Daniel Borkmann <dborkma@tik.ee.ethz.ch>");
92 MODULE_DESCRIPTION("LANA core driver");