Blame SOURCES/0010-src-cache-in-tree-and-use-x_tables.h.patch

0890d3
From f4f26b8d839a8fcd0ae43d2944436e1dbafdfda6 Mon Sep 17 00:00:00 2001
0890d3
From: Pablo Neira Ayuso <pablo@netfilter.org>
0890d3
Date: Wed, 1 Apr 2015 12:16:30 +0200
0890d3
Subject: [PATCH] src: cache in tree and use x_tables.h
0890d3
0890d3
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
0890d3
(cherry picked from commit 5700dbf07266c1ab888dceee75a040eb7af40950)
0890d3
Signed-off-by: Phil Sutter <psutter@redhat.com>
0890d3
---
0890d3
 include/libarptc/libarptc.h              |   1 +
0890d3
 include/linux/netfilter/x_tables.h       | 185 +++++++++++++++++++
0890d3
 include/linux/netfilter_arp/arp_tables.h | 222 +++++------------------
0890d3
 libarptc/libarptc_incl.c                 |  17 +-
0890d3
 4 files changed, 233 insertions(+), 192 deletions(-)
0890d3
 create mode 100644 include/linux/netfilter/x_tables.h
0890d3
0890d3
diff --git a/include/libarptc/libarptc.h b/include/libarptc/libarptc.h
0890d3
index e4f11752a201d..ff4606fb9ae16 100644
0890d3
--- a/include/libarptc/libarptc.h
0890d3
+++ b/include/libarptc/libarptc.h
0890d3
@@ -3,6 +3,7 @@
0890d3
 /* Library which manipulates filtering rules. */
0890d3
 
0890d3
 #include <libarptc/arpt_kernel_headers.h>
0890d3
+#include <linux/netfilter/x_tables.h>
0890d3
 #include <linux/netfilter_arp/arp_tables.h>
0890d3
 
0890d3
 #ifndef ARPT_MIN_ALIGN
0890d3
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
0890d3
new file mode 100644
0890d3
index 0000000000000..4120970072771
0890d3
--- /dev/null
0890d3
+++ b/include/linux/netfilter/x_tables.h
0890d3
@@ -0,0 +1,185 @@
0890d3
+#ifndef _X_TABLES_H
0890d3
+#define _X_TABLES_H
0890d3
+#include <linux/kernel.h>
0890d3
+#include <linux/types.h>
0890d3
+
0890d3
+#define XT_FUNCTION_MAXNAMELEN 30
0890d3
+#define XT_EXTENSION_MAXNAMELEN 29
0890d3
+#define XT_TABLE_MAXNAMELEN 32
0890d3
+
0890d3
+struct xt_entry_match {
0890d3
+	union {
0890d3
+		struct {
0890d3
+			__u16 match_size;
0890d3
+
0890d3
+			/* Used by userspace */
0890d3
+			char name[XT_EXTENSION_MAXNAMELEN];
0890d3
+			__u8 revision;
0890d3
+		} user;
0890d3
+		struct {
0890d3
+			__u16 match_size;
0890d3
+
0890d3
+			/* Used inside the kernel */
0890d3
+			struct xt_match *match;
0890d3
+		} kernel;
0890d3
+
0890d3
+		/* Total length */
0890d3
+		__u16 match_size;
0890d3
+	} u;
0890d3
+
0890d3
+	unsigned char data[0];
0890d3
+};
0890d3
+
0890d3
+struct xt_entry_target {
0890d3
+	union {
0890d3
+		struct {
0890d3
+			__u16 target_size;
0890d3
+
0890d3
+			/* Used by userspace */
0890d3
+			char name[XT_EXTENSION_MAXNAMELEN];
0890d3
+			__u8 revision;
0890d3
+		} user;
0890d3
+		struct {
0890d3
+			__u16 target_size;
0890d3
+
0890d3
+			/* Used inside the kernel */
0890d3
+			struct xt_target *target;
0890d3
+		} kernel;
0890d3
+
0890d3
+		/* Total length */
0890d3
+		__u16 target_size;
0890d3
+	} u;
0890d3
+
0890d3
+	unsigned char data[0];
0890d3
+};
0890d3
+
0890d3
+#define XT_TARGET_INIT(__name, __size)					       \
0890d3
+{									       \
0890d3
+	.target.u.user = {						       \
0890d3
+		.target_size	= XT_ALIGN(__size),			       \
0890d3
+		.name		= __name,				       \
0890d3
+	},								       \
0890d3
+}
0890d3
+
0890d3
+struct xt_standard_target {
0890d3
+	struct xt_entry_target target;
0890d3
+	int verdict;
0890d3
+};
0890d3
+
0890d3
+struct xt_error_target {
0890d3
+	struct xt_entry_target target;
0890d3
+	char errorname[XT_FUNCTION_MAXNAMELEN];
0890d3
+};
0890d3
+
0890d3
+/* The argument to IPT_SO_GET_REVISION_*.  Returns highest revision
0890d3
+ * kernel supports, if >= revision. */
0890d3
+struct xt_get_revision {
0890d3
+	char name[XT_EXTENSION_MAXNAMELEN];
0890d3
+	__u8 revision;
0890d3
+};
0890d3
+
0890d3
+/* CONTINUE verdict for targets */
0890d3
+#define XT_CONTINUE 0xFFFFFFFF
0890d3
+
0890d3
+/* For standard target */
0890d3
+#define XT_RETURN (-NF_REPEAT - 1)
0890d3
+
0890d3
+/* this is a dummy structure to find out the alignment requirement for a struct
0890d3
+ * containing all the fundamental data types that are used in ipt_entry,
0890d3
+ * ip6t_entry and arpt_entry.  This sucks, and it is a hack.  It will be my
0890d3
+ * personal pleasure to remove it -HW
0890d3
+ */
0890d3
+struct _xt_align {
0890d3
+	__u8 u8;
0890d3
+	__u16 u16;
0890d3
+	__u32 u32;
0890d3
+	__u64 u64;
0890d3
+};
0890d3
+
0890d3
+#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
0890d3
+
0890d3
+/* Standard return verdict, or do jump. */
0890d3
+#define XT_STANDARD_TARGET ""
0890d3
+/* Error verdict. */
0890d3
+#define XT_ERROR_TARGET "ERROR"
0890d3
+
0890d3
+#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
0890d3
+#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
0890d3
+
0890d3
+struct xt_counters {
0890d3
+	__u64 pcnt, bcnt;			/* Packet and byte counters */
0890d3
+};
0890d3
+
0890d3
+/* The argument to IPT_SO_ADD_COUNTERS. */
0890d3
+struct xt_counters_info {
0890d3
+	/* Which table. */
0890d3
+	char name[XT_TABLE_MAXNAMELEN];
0890d3
+
0890d3
+	unsigned int num_counters;
0890d3
+
0890d3
+	/* The counters (actually `number' of these). */
0890d3
+	struct xt_counters counters[0];
0890d3
+};
0890d3
+
0890d3
+#define XT_INV_PROTO		0x40	/* Invert the sense of PROTO. */
0890d3
+
0890d3
+/* fn returns 0 to continue iteration */
0890d3
+#define XT_MATCH_ITERATE(type, e, fn, args...)			\
0890d3
+({								\
0890d3
+	unsigned int __i;					\
0890d3
+	int __ret = 0;						\
0890d3
+	struct xt_entry_match *__m;				\
0890d3
+								\
0890d3
+	for (__i = sizeof(type);				\
0890d3
+	     __i < (e)->target_offset;				\
0890d3
+	     __i += __m->u.match_size) {			\
0890d3
+		__m = (void *)e + __i;				\
0890d3
+								\
0890d3
+		__ret = fn(__m , ## args);			\
0890d3
+		if (__ret != 0)					\
0890d3
+			break;					\
0890d3
+	}							\
0890d3
+	__ret;							\
0890d3
+})
0890d3
+
0890d3
+/* fn returns 0 to continue iteration */
0890d3
+#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
0890d3
+({								\
0890d3
+	unsigned int __i, __n;					\
0890d3
+	int __ret = 0;						\
0890d3
+	type *__entry;						\
0890d3
+								\
0890d3
+	for (__i = 0, __n = 0; __i < (size);			\
0890d3
+	     __i += __entry->next_offset, __n++) { 		\
0890d3
+		__entry = (void *)(entries) + __i;		\
0890d3
+		if (__n < n)					\
0890d3
+			continue;				\
0890d3
+								\
0890d3
+		__ret = fn(__entry , ## args);			\
0890d3
+		if (__ret != 0)					\
0890d3
+			break;					\
0890d3
+	}							\
0890d3
+	__ret;							\
0890d3
+})
0890d3
+
0890d3
+/* fn returns 0 to continue iteration */
0890d3
+#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
0890d3
+	XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
0890d3
+
0890d3
+
0890d3
+/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
0890d3
+#define xt_entry_foreach(pos, ehead, esize) \
0890d3
+	for ((pos) = (typeof(pos))(ehead); \
0890d3
+	     (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
0890d3
+	     (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
0890d3
+
0890d3
+/* can only be xt_entry_match, so no use of typeof here */
0890d3
+#define xt_ematch_foreach(pos, entry) \
0890d3
+	for ((pos) = (struct xt_entry_match *)entry->elems; \
0890d3
+	     (pos) < (struct xt_entry_match *)((char *)(entry) + \
0890d3
+	             (entry)->target_offset); \
0890d3
+	     (pos) = (struct xt_entry_match *)((char *)(pos) + \
0890d3
+	             (pos)->u.match_size))
0890d3
+
0890d3
+
0890d3
+#endif /* _X_TABLES_H */
0890d3
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
0890d3
index 0acda6620bd19..bb1ec648af257 100644
0890d3
--- a/include/linux/netfilter_arp/arp_tables.h
0890d3
+++ b/include/linux/netfilter_arp/arp_tables.h
0890d3
@@ -9,18 +9,25 @@
0890d3
 #ifndef _ARPTABLES_H
0890d3
 #define _ARPTABLES_H
0890d3
 
0890d3
-#ifdef __KERNEL__
0890d3
-#include <linux/if.h>
0890d3
 #include <linux/types.h>
0890d3
-#include <linux/in.h>
0890d3
-#include <linux/if_arp.h>
0890d3
-#include <linux/skbuff.h>
0890d3
-#endif
0890d3
 
0890d3
 #include <linux/netfilter_arp.h>
0890d3
 
0890d3
-#define ARPT_FUNCTION_MAXNAMELEN 30
0890d3
-#define ARPT_TABLE_MAXNAMELEN 32
0890d3
+#include <linux/netfilter/x_tables.h>
0890d3
+
0890d3
+#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
0890d3
+#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
0890d3
+#define arpt_entry_target xt_entry_target
0890d3
+#define arpt_standard_target xt_standard_target
0890d3
+#define arpt_error_target xt_error_target
0890d3
+#define ARPT_CONTINUE XT_CONTINUE
0890d3
+#define ARPT_RETURN XT_RETURN
0890d3
+#define arpt_counters_info xt_counters_info
0890d3
+#define arpt_counters xt_counters
0890d3
+#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
0890d3
+#define ARPT_ERROR_TARGET XT_ERROR_TARGET
0890d3
+#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
0890d3
+	XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
0890d3
 
0890d3
 #define ARPT_DEV_ADDR_LEN_MAX 16
0890d3
 
0890d3
@@ -37,16 +44,16 @@ struct arpt_arp {
0890d3
 	struct in_addr smsk, tmsk;
0890d3
 
0890d3
 	/* Device hw address length, src+target device addresses */
0890d3
-	u_int8_t arhln, arhln_mask;
0890d3
+	__u8 arhln, arhln_mask;
0890d3
 	struct arpt_devaddr_info src_devaddr;
0890d3
 	struct arpt_devaddr_info tgt_devaddr;
0890d3
 
0890d3
 	/* ARP operation code. */
0890d3
-	u_int16_t arpop, arpop_mask;
0890d3
+	__be16 arpop, arpop_mask;
0890d3
 
0890d3
 	/* ARP hardware address and protocol address format. */
0890d3
-	u_int16_t arhrd, arhrd_mask;
0890d3
-	u_int16_t arpro, arpro_mask;
0890d3
+	__be16 arhrd, arhrd_mask;
0890d3
+	__be16 arpro, arpro_mask;
0890d3
 
0890d3
 	/* The protocol address length is only accepted if it is 4
0890d3
 	 * so there is no use in offering a way to do filtering on it.
0890d3
@@ -56,43 +63,9 @@ struct arpt_arp {
0890d3
 	unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
0890d3
 
0890d3
 	/* Flags word */
0890d3
-	u_int8_t flags;
0890d3
+	__u8 flags;
0890d3
 	/* Inverse flags */
0890d3
-	u_int16_t invflags;
0890d3
-};
0890d3
-
0890d3
-struct arpt_entry_target
0890d3
-{
0890d3
-	union {
0890d3
-		struct {
0890d3
-			u_int16_t target_size;
0890d3
-
0890d3
-			/* Used by userspace */
0890d3
-			char name[ARPT_FUNCTION_MAXNAMELEN];
0890d3
-		} user;
0890d3
-		struct {
0890d3
-			u_int16_t target_size;
0890d3
-
0890d3
-			/* Used inside the kernel */
0890d3
-			struct arpt_target *target;
0890d3
-		} kernel;
0890d3
-
0890d3
-		/* Total length */
0890d3
-		u_int16_t target_size;
0890d3
-	} u;
0890d3
-
0890d3
-	unsigned char data[0];
0890d3
-};
0890d3
-
0890d3
-struct arpt_standard_target
0890d3
-{
0890d3
-	struct arpt_entry_target target;
0890d3
-	int verdict;
0890d3
-};
0890d3
-
0890d3
-struct arpt_counters
0890d3
-{
0890d3
-	u_int64_t pcnt, bcnt;			/* Packet and byte counters */
0890d3
+	__u16 invflags;
0890d3
 };
0890d3
 
0890d3
 /* Values for "flag" field in struct arpt_ip (general arp structure).
0890d3
@@ -121,15 +94,15 @@ struct arpt_entry
0890d3
 	struct arpt_arp arp;
0890d3
 
0890d3
 	/* Size of arpt_entry + matches */
0890d3
-	u_int16_t target_offset;
0890d3
+	__u16 target_offset;
0890d3
 	/* Size of arpt_entry + matches + target */
0890d3
-	u_int16_t next_offset;
0890d3
+	__u16 next_offset;
0890d3
 
0890d3
 	/* Back pointer */
0890d3
 	unsigned int comefrom;
0890d3
 
0890d3
 	/* Packet and byte counters. */
0890d3
-	struct arpt_counters counters;
0890d3
+	struct xt_counters counters;
0890d3
 
0890d3
 	/* The matches (if any), then the target. */
0890d3
 	unsigned char elems[0];
0890d3
@@ -139,8 +112,10 @@ struct arpt_entry
0890d3
  * New IP firewall options for [gs]etsockopt at the RAW IP level.
0890d3
  * Unlike BSD Linux inherits IP options so you don't have to use a raw
0890d3
  * socket for this. Instead we check rights in the calls.
0890d3
+ *
0890d3
+ * ATTENTION: check linux/in.h before adding new number here.
0890d3
  */
0890d3
-#define ARPT_BASE_CTL		96	/* base for firewall socket options */
0890d3
+#define ARPT_BASE_CTL		96
0890d3
 
0890d3
 #define ARPT_SO_SET_REPLACE		(ARPT_BASE_CTL)
0890d3
 #define ARPT_SO_SET_ADD_COUNTERS	(ARPT_BASE_CTL + 1)
0890d3
@@ -148,29 +123,24 @@ struct arpt_entry
0890d3
 
0890d3
 #define ARPT_SO_GET_INFO		(ARPT_BASE_CTL)
0890d3
 #define ARPT_SO_GET_ENTRIES		(ARPT_BASE_CTL + 1)
0890d3
-#define ARPT_SO_GET_MAX			ARPT_SO_GET_ENTRIES
0890d3
-
0890d3
-/* CONTINUE verdict for targets */
0890d3
-#define ARPT_CONTINUE 0xFFFFFFFF
0890d3
-
0890d3
-/* For standard target */
0890d3
-#define ARPT_RETURN (-NF_REPEAT - 1)
0890d3
+/* #define ARPT_SO_GET_REVISION_MATCH	(APRT_BASE_CTL + 2) */
0890d3
+#define ARPT_SO_GET_REVISION_TARGET	(ARPT_BASE_CTL + 3)
0890d3
+#define ARPT_SO_GET_MAX			(ARPT_SO_GET_REVISION_TARGET)
0890d3
 
0890d3
 /* The argument to ARPT_SO_GET_INFO */
0890d3
-struct arpt_getinfo
0890d3
-{
0890d3
+struct arpt_getinfo {
0890d3
 	/* Which table: caller fills this in. */
0890d3
-	char name[ARPT_TABLE_MAXNAMELEN];
0890d3
+	char name[XT_TABLE_MAXNAMELEN];
0890d3
 
0890d3
 	/* Kernel fills these in. */
0890d3
 	/* Which hook entry points are valid: bitmask */
0890d3
 	unsigned int valid_hooks;
0890d3
 
0890d3
 	/* Hook entry points: one per netfilter hook. */
0890d3
-	unsigned int hook_entry[3];
0890d3
+	unsigned int hook_entry[NF_ARP_NUMHOOKS];
0890d3
 
0890d3
 	/* Underflow points. */
0890d3
-	unsigned int underflow[3];
0890d3
+	unsigned int underflow[NF_ARP_NUMHOOKS];
0890d3
 
0890d3
 	/* Number of entries */
0890d3
 	unsigned int num_entries;
0890d3
@@ -180,10 +150,9 @@ struct arpt_getinfo
0890d3
 };
0890d3
 
0890d3
 /* The argument to ARPT_SO_SET_REPLACE. */
0890d3
-struct arpt_replace
0890d3
-{
0890d3
+struct arpt_replace {
0890d3
 	/* Which table. */
0890d3
-	char name[ARPT_TABLE_MAXNAMELEN];
0890d3
+	char name[XT_TABLE_MAXNAMELEN];
0890d3
 
0890d3
 	/* Which hook entry points are valid: bitmask.  You can't
0890d3
            change this. */
0890d3
@@ -196,38 +165,25 @@ struct arpt_replace
0890d3
 	unsigned int size;
0890d3
 
0890d3
 	/* Hook entry points. */
0890d3
-	unsigned int hook_entry[3];
0890d3
+	unsigned int hook_entry[NF_ARP_NUMHOOKS];
0890d3
 
0890d3
 	/* Underflow points. */
0890d3
-	unsigned int underflow[3];
0890d3
+	unsigned int underflow[NF_ARP_NUMHOOKS];
0890d3
 
0890d3
 	/* Information about old entries: */
0890d3
 	/* Number of counters (must be equal to current number of entries). */
0890d3
 	unsigned int num_counters;
0890d3
 	/* The old entries' counters. */
0890d3
-	struct arpt_counters *counters;
0890d3
+	struct xt_counters *counters;
0890d3
 
0890d3
 	/* The entries (hang off end: not really an array). */
0890d3
 	struct arpt_entry entries[0];
0890d3
 };
0890d3
 
0890d3
-/* The argument to ARPT_SO_ADD_COUNTERS. */
0890d3
-struct arpt_counters_info
0890d3
-{
0890d3
-	/* Which table. */
0890d3
-	char name[ARPT_TABLE_MAXNAMELEN];
0890d3
-
0890d3
-	unsigned int num_counters;
0890d3
-
0890d3
-	/* The counters (actually `number' of these). */
0890d3
-	struct arpt_counters counters[0];
0890d3
-};
0890d3
-
0890d3
 /* The argument to ARPT_SO_GET_ENTRIES. */
0890d3
-struct arpt_get_entries
0890d3
-{
0890d3
+struct arpt_get_entries {
0890d3
 	/* Which table: user fills this in. */
0890d3
-	char name[ARPT_TABLE_MAXNAMELEN];
0890d3
+	char name[XT_TABLE_MAXNAMELEN];
0890d3
 
0890d3
 	/* User fills this in: total entry size. */
0890d3
 	unsigned int size;
0890d3
@@ -236,107 +192,13 @@ struct arpt_get_entries
0890d3
 	struct arpt_entry entrytable[0];
0890d3
 };
0890d3
 
0890d3
-/* Standard return verdict, or do jump. */
0890d3
-#define ARPT_STANDARD_TARGET ""
0890d3
-/* Error verdict. */
0890d3
-#define ARPT_ERROR_TARGET "ERROR"
0890d3
-
0890d3
 /* Helper functions */
0890d3
-static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e)
0890d3
+static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
0890d3
 {
0890d3
 	return (void *)e + e->target_offset;
0890d3
 }
0890d3
 
0890d3
-/* fn returns 0 to continue iteration */
0890d3
-#define ARPT_ENTRY_ITERATE(entries, size, fn, args...)		\
0890d3
-({								\
0890d3
-	unsigned int __i;					\
0890d3
-	int __ret = 0;						\
0890d3
-	struct arpt_entry *__entry;				\
0890d3
-								\
0890d3
-	for (__i = 0; __i < (size); __i += __entry->next_offset) { \
0890d3
-		__entry = (void *)(entries) + __i;		\
0890d3
-								\
0890d3
-		__ret = fn(__entry , ## args);			\
0890d3
-		if (__ret != 0)					\
0890d3
-			break;					\
0890d3
-	}							\
0890d3
-	__ret;							\
0890d3
-})
0890d3
-
0890d3
 /*
0890d3
  *	Main firewall chains definitions and global var's definitions.
0890d3
  */
0890d3
-#ifdef __KERNEL__
0890d3
-
0890d3
-/* Registration hooks for targets. */
0890d3
-struct arpt_target
0890d3
-{
0890d3
-	struct list_head list;
0890d3
-
0890d3
-	const char name[ARPT_FUNCTION_MAXNAMELEN];
0890d3
-
0890d3
-	/* Returns verdict. */
0890d3
-	unsigned int (*target)(struct sk_buff **pskb,
0890d3
-			       unsigned int hooknum,
0890d3
-			       const struct net_device *in,
0890d3
-			       const struct net_device *out,
0890d3
-			       const void *targinfo,
0890d3
-			       void *userdata);
0890d3
-
0890d3
-	/* Called when user tries to insert an entry of this type:
0890d3
-           hook_mask is a bitmask of hooks from which it can be
0890d3
-           called. */
0890d3
-	/* Should return true or false. */
0890d3
-	int (*checkentry)(const char *tablename,
0890d3
-			  const struct arpt_entry *e,
0890d3
-			  void *targinfo,
0890d3
-			  unsigned int targinfosize,
0890d3
-			  unsigned int hook_mask);
0890d3
-
0890d3
-	/* Called when entry of this type deleted. */
0890d3
-	void (*destroy)(void *targinfo, unsigned int targinfosize);
0890d3
-
0890d3
-	/* Set this to THIS_MODULE if you are a module, otherwise NULL */
0890d3
-	struct module *me;
0890d3
-};
0890d3
-
0890d3
-extern int arpt_register_target(struct arpt_target *target);
0890d3
-extern void arpt_unregister_target(struct arpt_target *target);
0890d3
-
0890d3
-/* Furniture shopping... */
0890d3
-struct arpt_table
0890d3
-{
0890d3
-	struct list_head list;
0890d3
-
0890d3
-	/* A unique name... */
0890d3
-	char name[ARPT_TABLE_MAXNAMELEN];
0890d3
-
0890d3
-	/* Seed table: copied in register_table */
0890d3
-	struct arpt_replace *table;
0890d3
-
0890d3
-	/* What hooks you will enter on */
0890d3
-	unsigned int valid_hooks;
0890d3
-
0890d3
-	/* Lock for the curtain */
0890d3
-	rwlock_t lock;
0890d3
-
0890d3
-	/* Man behind the curtain... */
0890d3
-	struct arpt_table_info *private;
0890d3
-
0890d3
-	/* Set this to THIS_MODULE if you are a module, otherwise NULL */
0890d3
-	struct module *me;
0890d3
-};
0890d3
-
0890d3
-extern int arpt_register_table(struct arpt_table *table);
0890d3
-extern void arpt_unregister_table(struct arpt_table *table);
0890d3
-extern unsigned int arpt_do_table(struct sk_buff **pskb,
0890d3
-				  unsigned int hook,
0890d3
-				  const struct net_device *in,
0890d3
-				  const struct net_device *out,
0890d3
-				  struct arpt_table *table,
0890d3
-				  void *userdata);
0890d3
-
0890d3
-#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1))
0890d3
-#endif /*__KERNEL__*/
0890d3
 #endif /* _ARPTABLES_H */
0890d3
diff --git a/libarptc/libarptc_incl.c b/libarptc/libarptc_incl.c
0890d3
index 1d2e8b7b7ac01..a034930600344 100644
0890d3
--- a/libarptc/libarptc_incl.c
0890d3
+++ b/libarptc/libarptc_incl.c
0890d3
@@ -40,13 +40,6 @@ struct counter_map
0890d3
 	unsigned int mappos;
0890d3
 };
0890d3
 
0890d3
-/* Convenience structures */
0890d3
-struct arpt_error_target
0890d3
-{
0890d3
-	STRUCT_ENTRY_TARGET t;
0890d3
-	char error[TABLE_MAXNAMELEN];
0890d3
-};
0890d3
-
0890d3
 struct chain_cache
0890d3
 {
0890d3
 	char name[TABLE_MAXNAMELEN];
0890d3
@@ -1342,9 +1335,9 @@ TC_CREATE_CHAIN(const ARPT_CHAINLABEL chain, TC_HANDLE_T *handle)
0890d3
 	newc.head.next_offset
0890d3
 		= sizeof(STRUCT_ENTRY)
0890d3
 		+ ALIGN(sizeof(struct arpt_error_target));
0890d3
-	strcpy(newc.name.t.u.user.name, ERROR_TARGET);
0890d3
-	newc.name.t.u.target_size = ALIGN(sizeof(struct arpt_error_target));
0890d3
-	strcpy(newc.name.error, chain);
0890d3
+	strcpy(newc.name.target.u.user.name, ERROR_TARGET);
0890d3
+	newc.name.target.u.target_size = ALIGN(sizeof(struct arpt_error_target));
0890d3
+	strcpy(newc.name.errorname, chain);
0890d3
 
0890d3
 	newc.ret.target_offset = sizeof(STRUCT_ENTRY);
0890d3
 	newc.ret.next_offset
0890d3
@@ -1482,8 +1475,8 @@ int TC_RENAME_CHAIN(const ARPT_CHAINLABEL oldname,
0890d3
 	t = (struct arpt_error_target *)
0890d3
 		GET_TARGET(get_entry(*handle, labeloff));
0890d3
 
0890d3
-	memset(t->error, 0, sizeof(t->error));
0890d3
-	strcpy(t->error, newname);
0890d3
+	memset(t->errorname, 0, sizeof(t->errorname));
0890d3
+	strcpy(t->errorname, newname);
0890d3
 	set_changed(*handle);
0890d3
 
0890d3
 	return 1;
0890d3
-- 
0890d3
2.21.0
0890d3