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
......@@ -14,6 +14,7 @@
#include <net/netfilter/nf_conntrack_extend.h>
#include <net/netfilter/nf_conntrack_helper.h>
#include <net/netfilter/nf_flow_table.h>
#include <linux/proc_fs.h>
static struct nf_flowtable nf_flowtable;
static HLIST_HEAD(hooks);
......@@ -392,10 +393,40 @@ static struct notifier_block flow_offload_netdev_notifier = {
.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)
{
int ret;
register_flow_table_ctrl();
register_netdevice_notifier(&flow_offload_netdev_notifier);
INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work);
......@@ -415,6 +446,7 @@ static void __exit xt_flowoffload_tg_exit(void)
{
xt_unregister_target(&offload_tg_reg);
xt_flowoffload_table_cleanup(&nf_flowtable);
unregister_flow_table_ctrl();
unregister_netdevice_notifier(&flow_offload_netdev_notifier);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment