Blame SOURCES/0012-arptables-Add-revision-field-for-arptables-userspace.patch

0890d3
From 4c30ed220bbcc4a8060b382b536a615dd296a6fa Mon Sep 17 00:00:00 2001
0890d3
From: Zhang Chunyu <zhangcy@cn.fujitsu.com>
0890d3
Date: Sun, 29 Mar 2015 22:35:47 -0400
0890d3
Subject: [PATCH] arptables: Add revision field for arptables userspace
0890d3
0890d3
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
0890d3
Signed-off-by: Zhang Chunyu <zhangcy@cn.fujitsu.com>
0890d3
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
0890d3
(cherry picked from commit dbbe9f7de36aa3c7dd61dc89092c03f7902e474e)
0890d3
Signed-off-by: Phil Sutter <psutter@redhat.com>
0890d3
---
0890d3
 arptables.c                | 2 ++
0890d3
 extensions/arpt_CLASSIFY.c | 1 +
0890d3
 extensions/arpt_mangle.c   | 1 +
0890d3
 extensions/arpt_standard.c | 1 +
0890d3
 include/arptables.h        | 6 ++++++
0890d3
 libarptc/libarptc_incl.c   | 2 +-
0890d3
 6 files changed, 12 insertions(+), 1 deletion(-)
0890d3
0890d3
diff --git a/arptables.c b/arptables.c
0890d3
index f820ffa894e00..fbe7350be3f32 100644
0890d3
--- a/arptables.c
0890d3
+++ b/arptables.c
0890d3
@@ -2067,6 +2067,7 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle)
0890d3
 				target->t->u.target_size = size;
0890d3
 				strncpy(target->t->u.user.name, jumpto, sizeof(target->t->u.user.name));
0890d3
 				target->t->u.user.name[sizeof(target->t->u.user.name)-1] = '\0';
0890d3
+				target->t->u.user.revision = target->revision;
0890d3
 /*
0890d3
 				target->init(target->t, &fw.nfcache);
0890d3
 */
0890d3
@@ -2392,6 +2393,7 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle)
0890d3
 			target->t = fw_calloc(1, size);
0890d3
 			target->t->u.target_size = size;
0890d3
 			strcpy(target->t->u.user.name, jumpto);
0890d3
+			target->t->u.user.revision = target->revision;
0890d3
 			target->init(target->t);
0890d3
 		}
0890d3
 
0890d3
diff --git a/extensions/arpt_CLASSIFY.c b/extensions/arpt_CLASSIFY.c
0890d3
index cb5770be8053c..7893aed31c057 100644
0890d3
--- a/extensions/arpt_CLASSIFY.c
0890d3
+++ b/extensions/arpt_CLASSIFY.c
0890d3
@@ -105,6 +105,7 @@ struct arptables_target classify
0890d3
 	ARPTABLES_VERSION,
0890d3
 	ARPT_ALIGN(sizeof(struct xt_classify_target_info)),
0890d3
 	ARPT_ALIGN(sizeof(struct xt_classify_target_info)),
0890d3
+	0,
0890d3
 	&help,
0890d3
 	&init,
0890d3
 	&parse,
0890d3
diff --git a/extensions/arpt_mangle.c b/extensions/arpt_mangle.c
0890d3
index c38fc1668236d..c7c3a7a42fc36 100644
0890d3
--- a/extensions/arpt_mangle.c
0890d3
+++ b/extensions/arpt_mangle.c
0890d3
@@ -199,6 +199,7 @@ struct arptables_target change
0890d3
     ARPTABLES_VERSION,
0890d3
     ARPT_ALIGN(sizeof(struct arpt_mangle)),
0890d3
     ARPT_ALIGN(sizeof(struct arpt_mangle)),
0890d3
+    0,
0890d3
     &help,
0890d3
     &init,
0890d3
     &parse,
0890d3
diff --git a/extensions/arpt_standard.c b/extensions/arpt_standard.c
0890d3
index cb3891d871102..6c2b1874acb59 100644
0890d3
--- a/extensions/arpt_standard.c
0890d3
+++ b/extensions/arpt_standard.c
0890d3
@@ -54,6 +54,7 @@ struct arptables_target standard
0890d3
     ARPTABLES_VERSION,
0890d3
     ARPT_ALIGN(sizeof(int)),
0890d3
     ARPT_ALIGN(sizeof(int)),
0890d3
+    0,
0890d3
     &help,
0890d3
     &init,
0890d3
     &parse,
0890d3
diff --git a/include/arptables.h b/include/arptables.h
0890d3
index 820b66460cfbe..82e6e9a80445e 100644
0890d3
--- a/include/arptables.h
0890d3
+++ b/include/arptables.h
0890d3
@@ -32,6 +32,9 @@ struct arptables_match
0890d3
 	/* Size of match data relevent for userspace comparison purposes */
0890d3
 	size_t userspacesize;
0890d3
 
0890d3
+	/* Revision of target (0 by default). */
0890d3
+	u_int8_t revision;
0890d3
+
0890d3
 	/* Function which prints out usage message. */
0890d3
 	void (*help)(void);
0890d3
 
0890d3
@@ -81,6 +84,9 @@ struct arptables_target
0890d3
 	/* Size of target data relevent for userspace comparison purposes */
0890d3
 	size_t userspacesize;
0890d3
 
0890d3
+	/* Revision of target (0 by default). */
0890d3
+	u_int8_t revision;
0890d3
+
0890d3
 	/* Function which prints out usage message. */
0890d3
 	void (*help)(void);
0890d3
 
0890d3
diff --git a/libarptc/libarptc_incl.c b/libarptc/libarptc_incl.c
0890d3
index a034930600344..87404ce185d77 100644
0890d3
--- a/libarptc/libarptc_incl.c
0890d3
+++ b/libarptc/libarptc_incl.c
0890d3
@@ -872,7 +872,7 @@ map_target(const TC_HANDLE_T handle,
0890d3
 	/* memset to all 0 for your memcmp convenience. */
0890d3
 	memset(t->u.user.name + strlen(t->u.user.name),
0890d3
 	       0,
0890d3
-	       FUNCTION_MAXNAMELEN - strlen(t->u.user.name));
0890d3
+	       FUNCTION_MAXNAMELEN - 1 - strlen(t->u.user.name));
0890d3
 	return 1;
0890d3
 }
0890d3
 
0890d3
-- 
0890d3
2.21.0
0890d3