[Devel] [PATCH RHEL7 COMMIT] vzprivnet: Add stuff required for ipv6 support

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 24 08:53:33 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.3
------>
commit 96d1a13d12dce6faec144b100b4515db3810a577
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Thu Mar 24 19:53:33 2016 +0400

    vzprivnet: Add stuff required for ipv6 support
    
    Port diff-vz-privnet-v6-support-prep
      vzprivnet: Add stuff required for ipv6 support
    
      Export the proc dir pointer and add the ability to extent stat file
      Move is_eol to header :)
    
      Taken from 2.6.18-rh5
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 include/linux/vzprivnet.h         | 14 ++++++++++++++
 net/ipv4/netfilter/ip_vzprivnet.c | 38 +++++++++++++++++++++++++++++++++++---
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/include/linux/vzprivnet.h b/include/linux/vzprivnet.h
new file mode 100644
index 0000000..1e660e0
--- /dev/null
+++ b/include/linux/vzprivnet.h
@@ -0,0 +1,14 @@
+#ifndef __IP_VZPRIVNET_H__
+#define __IP_VZPRIVNET_H__
+
+struct proc_dir_entry;
+extern struct proc_dir_entry *vzpriv_proc_dir;
+
+struct seq_file;
+typedef void (*vzprivnet_show_fn)(struct seq_file *);
+void vzprivnet_reg_show(vzprivnet_show_fn);
+void vzprivnet_unreg_show(vzprivnet_show_fn);
+
+#define is_eol(ch)	((ch) == '\0' || (ch) == '\n')
+
+#endif
diff --git a/net/ipv4/netfilter/ip_vzprivnet.c b/net/ipv4/netfilter/ip_vzprivnet.c
index e3b7610..2e950eb 100644
--- a/net/ipv4/netfilter/ip_vzprivnet.c
+++ b/net/ipv4/netfilter/ip_vzprivnet.c
@@ -31,6 +31,7 @@
 #include <net/route.h>
 #include <asm/page.h>
 
+#include <linux/vzprivnet.h>
 #define VZPRIV_PROCNAME "ip_vzprivnet"
 
 enum {
@@ -670,8 +671,6 @@ static int sparse_del(unsigned int netid, u32 ip, int weak)
  *  No weak networks here!
  */
 
-#define is_eol(ch)	((ch) == '\0' || (ch) == '\n')
-
 static int parse_sparse_add(const char *str, unsigned int *netid, u32 *ip, u32 *mask, int *weak)
 {
 	unsigned int m;
@@ -862,6 +861,37 @@ static struct file_operations proc_sparse_ops = {
 	.write   = sparse_write,
 };
 
+static void (*show_more)(struct seq_file *s);
+static DEFINE_MUTEX(show_lock);
+
+static void vzprivnet_reg_swap(vzprivnet_show_fn old, vzprivnet_show_fn new)
+{
+	mutex_lock(&show_lock);
+	if (show_more == old)
+		show_more = new;
+	mutex_unlock(&show_lock);
+}
+
+static void vzprivnet_show_more(struct seq_file *f)
+{
+	mutex_lock(&show_lock);
+	if (show_more != NULL)
+		show_more(f);
+	mutex_unlock(&show_lock);
+}
+
+void vzprivnet_reg_show(vzprivnet_show_fn fn)
+{
+	vzprivnet_reg_swap(NULL, fn);
+}
+EXPORT_SYMBOL(vzprivnet_reg_show);
+
+void vzprivnet_unreg_show(vzprivnet_show_fn fn)
+{
+	vzprivnet_reg_swap(fn, NULL);
+}
+EXPORT_SYMBOL(vzprivnet_unreg_show);
+
 static int stat_seq_show(struct seq_file *s, void *v)
 {
 	unsigned long sum;
@@ -872,6 +902,7 @@ static int stat_seq_show(struct seq_file *s, void *v)
 		sum += per_cpu(lookup_stat, cpu);
 
 	seq_printf(s, "Lookups: %lu\n", sum);
+	vzprivnet_show_more(s);
 
 	return 0;
 }
@@ -969,7 +1000,8 @@ static struct file_operations proc_classify_ops = {
 	.write	 = classify_write,
 };
 
-static struct proc_dir_entry *vzpriv_proc_dir;
+struct proc_dir_entry *vzpriv_proc_dir;
+EXPORT_SYMBOL(vzpriv_proc_dir);
 
 static int __init iptable_vzprivnet_init(void)
 {


More information about the Devel mailing list