Skip to content
Snippets Groups Projects
Commit d79515d2 authored by Anas Sayed's avatar Anas Sayed Committed by Roman Azarenko
Browse files

Add flowtable flows de-acceleration procfs option

parent 1d9616c1
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <net/netfilter/nf_conntrack_extend.h> #include <net/netfilter/nf_conntrack_extend.h>
#include <net/netfilter/nf_conntrack_helper.h> #include <net/netfilter/nf_conntrack_helper.h>
#include <net/netfilter/nf_flow_table.h> #include <net/netfilter/nf_flow_table.h>
#include <linux/proc_fs.h>
static struct nf_flowtable nf_flowtable; static struct nf_flowtable nf_flowtable;
static HLIST_HEAD(hooks); static HLIST_HEAD(hooks);
...@@ -392,10 +393,40 @@ static struct notifier_block flow_offload_netdev_notifier = { ...@@ -392,10 +393,40 @@ static struct notifier_block flow_offload_netdev_notifier = {
.notifier_call = flow_offload_netdev_event, .notifier_call = flow_offload_netdev_event,
}; };
static struct proc_dir_entry *procfs_subdir_entry;
static ssize_t procfs_callback(struct file *f, const char __user *u,
size_t count, loff_t *p)
{
nf_flow_table_cleanup(NULL, NULL);
return count;
}
#define PROC_SUBDIR "nf-flow-table-control"
#define PROC_ACTION "clear"
static void register_flow_table_ctrl(void)
{
static struct file_operations ops = {
.owner = THIS_MODULE,
.write = procfs_callback
};
procfs_subdir_entry = proc_mkdir(PROC_SUBDIR, NULL);
proc_create(PROC_ACTION, 0220, procfs_subdir_entry, &ops);
}
static void unregister_flow_table_ctrl(void)
{
remove_proc_entry(PROC_ACTION, procfs_subdir_entry);
remove_proc_entry(PROC_SUBDIR, NULL);
}
static int __init xt_flowoffload_tg_init(void) static int __init xt_flowoffload_tg_init(void)
{ {
int ret; int ret;
register_flow_table_ctrl();
register_netdevice_notifier(&flow_offload_netdev_notifier); register_netdevice_notifier(&flow_offload_netdev_notifier);
INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work); INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work);
...@@ -415,6 +446,7 @@ static void __exit xt_flowoffload_tg_exit(void) ...@@ -415,6 +446,7 @@ static void __exit xt_flowoffload_tg_exit(void)
{ {
xt_unregister_target(&offload_tg_reg); xt_unregister_target(&offload_tg_reg);
xt_flowoffload_table_cleanup(&nf_flowtable); xt_flowoffload_table_cleanup(&nf_flowtable);
unregister_flow_table_ctrl();
unregister_netdevice_notifier(&flow_offload_netdev_notifier); unregister_netdevice_notifier(&flow_offload_netdev_notifier);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment