Blame SOURCES/0007-Add-kernel-headers-needed-from-v3.16.patch

05e71a
From a29aa9b111e00fcf6dd8268a2a18314df0ea0d4b Mon Sep 17 00:00:00 2001
05e71a
From: Pedro Alvarez <pedro.alvarez@codethink.co.uk>
05e71a
Date: Fri, 27 Feb 2015 11:54:10 +0000
05e71a
Subject: [PATCH] Add kernel headers needed from v3.16
05e71a
05e71a
Ebtables fails to compile with versions of the linux headers greater
05e71a
than v3.16 with this error:
05e71a
05e71a
  extensions/ebt_ulog.c:17:45: fatal error: linux/netfilter_bridge/ebt_ulog.h: No such file or directory
05e71a
   #include <linux/netfilter_bridge/ebt_ulog.h>
05e71a
05e71a
This patch adds netfilter_bridge headers for every supported
05e71a
extension, including filter.h and types.h, to avoid this problem and
05e71a
future problems with changes in the kernel headers.
05e71a
05e71a
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
05e71a
Signed-off-by: Phil Sutter <psutter@redhat.com>
05e71a
---
05e71a
 include/linux/netfilter_bridge.h           |  2 +-
05e71a
 include/linux/netfilter_bridge/ebt_802_3.h |  7 ++-
05e71a
 include/linux/netfilter_bridge/ebtables.h  | 70 ++++++++++------------
05e71a
 include/linux/types.h                      |  2 +-
05e71a
 4 files changed, 37 insertions(+), 44 deletions(-)
05e71a
05e71a
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
05e71a
index 5094ecca9c1b3..c4dbfd91a17b9 100644
05e71a
--- a/include/linux/netfilter_bridge.h
05e71a
+++ b/include/linux/netfilter_bridge.h
05e71a
@@ -24,4 +24,4 @@
05e71a
 #define NF_BR_BROUTING		5
05e71a
 #define NF_BR_NUMHOOKS		6
05e71a
 
05e71a
-#endif
05e71a
+#endif /* __LINUX_BRIDGE_NETFILTER_H */
05e71a
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
05e71a
index 76687d51f0eb8..70028c1523164 100644
05e71a
--- a/include/linux/netfilter_bridge/ebt_802_3.h
05e71a
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
05e71a
@@ -2,6 +2,7 @@
05e71a
 #define __LINUX_BRIDGE_EBT_802_3_H
05e71a
 
05e71a
 #include <linux/types.h>
05e71a
+#include <linux/if_ether.h>
05e71a
 
05e71a
 #define EBT_802_3_SAP 0x01
05e71a
 #define EBT_802_3_TYPE 0x02
05e71a
@@ -42,8 +43,8 @@ struct hdr_ni {
05e71a
 };
05e71a
 
05e71a
 struct ebt_802_3_hdr {
05e71a
-	__u8  daddr[6];
05e71a
-	__u8  saddr[6];
05e71a
+	__u8  daddr[ETH_ALEN];
05e71a
+	__u8  saddr[ETH_ALEN];
05e71a
 	__be16 len;
05e71a
 	union {
05e71a
 		struct hdr_ui ui;
05e71a
@@ -59,4 +60,4 @@ struct ebt_802_3_info {
05e71a
 	__u8  invflags;
05e71a
 };
05e71a
 
05e71a
-#endif
05e71a
+#endif /* __LINUX_BRIDGE_EBT_802_3_H */
05e71a
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
05e71a
index 8f520c600b356..19a64448c648e 100644
05e71a
--- a/include/linux/netfilter_bridge/ebtables.h
05e71a
+++ b/include/linux/netfilter_bridge/ebtables.h
05e71a
@@ -10,7 +10,6 @@
05e71a
  *  Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling
05e71a
  */
05e71a
 
05e71a
-/* Local copy of the kernel file, needed for Sparc64 support */
05e71a
 #ifndef __LINUX_BRIDGE_EFF_H
05e71a
 #define __LINUX_BRIDGE_EFF_H
05e71a
 #include <linux/if.h>
05e71a
@@ -32,14 +31,31 @@
05e71a
  * The 4 lsb are more than enough to store the verdict. */
05e71a
 #define EBT_VERDICT_BITS 0x0000000F
05e71a
 
05e71a
-struct ebt_counter
05e71a
-{
05e71a
+struct xt_match;
05e71a
+struct xt_target;
05e71a
+
05e71a
+struct ebt_counter {
05e71a
 	uint64_t pcnt;
05e71a
 	uint64_t bcnt;
05e71a
 };
05e71a
 
05e71a
-struct ebt_replace
05e71a
-{
05e71a
+struct ebt_replace {
05e71a
+	char name[EBT_TABLE_MAXNAMELEN];
05e71a
+	unsigned int valid_hooks;
05e71a
+	/* nr of rules in the table */
05e71a
+	unsigned int nentries;
05e71a
+	/* total size of the entries */
05e71a
+	unsigned int entries_size;
05e71a
+	/* start of the chains */
05e71a
+	struct ebt_entries *hook_entry[NF_BR_NUMHOOKS];
05e71a
+	/* nr of counters userspace expects back */
05e71a
+	unsigned int num_counters;
05e71a
+	/* where the kernel will put the old counters */
05e71a
+	struct ebt_counter *counters;
05e71a
+	char *entries;
05e71a
+};
05e71a
+
05e71a
+struct ebt_replace_kernel {
05e71a
 	char name[EBT_TABLE_MAXNAMELEN];
05e71a
 	unsigned int valid_hooks;
05e71a
 	/* nr of rules in the table */
05e71a
@@ -47,21 +63,12 @@ struct ebt_replace
05e71a
 	/* total size of the entries */
05e71a
 	unsigned int entries_size;
05e71a
 	/* start of the chains */
05e71a
-#ifdef KERNEL_64_USERSPACE_32
05e71a
-	uint64_t hook_entry[NF_BR_NUMHOOKS];
05e71a
-#else
05e71a
 	struct ebt_entries *hook_entry[NF_BR_NUMHOOKS];
05e71a
-#endif
05e71a
 	/* nr of counters userspace expects back */
05e71a
 	unsigned int num_counters;
05e71a
 	/* where the kernel will put the old counters */
05e71a
-#ifdef KERNEL_64_USERSPACE_32
05e71a
-	uint64_t counters;
05e71a
-	uint64_t entries;
05e71a
-#else
05e71a
 	struct ebt_counter *counters;
05e71a
 	char *entries;
05e71a
-#endif
05e71a
 };
05e71a
 
05e71a
 struct ebt_entries {
05e71a
@@ -85,7 +92,7 @@ struct ebt_entries {
05e71a
 
05e71a
 /* This is a hack to make a difference between an ebt_entry struct and an
05e71a
  * ebt_entries struct when traversing the entries from start to end.
05e71a
- * Using this simplifies the code alot, while still being able to use
05e71a
+ * Using this simplifies the code a lot, while still being able to use
05e71a
  * ebt_entries.
05e71a
  * Contrary, iptables doesn't use something like ebt_entries and therefore uses
05e71a
  * different techniques for naming the policy and such. So, iptables doesn't
05e71a
@@ -110,56 +117,40 @@ struct ebt_entries {
05e71a
 #define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \
05e71a
    | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST)
05e71a
 
05e71a
-struct ebt_entry_match
05e71a
-{
05e71a
+struct ebt_entry_match {
05e71a
 	union {
05e71a
 		char name[EBT_FUNCTION_MAXNAMELEN];
05e71a
-		struct ebt_match *match;
05e71a
+		struct xt_match *match;
05e71a
 	} u;
05e71a
 	/* size of data */
05e71a
 	unsigned int match_size;
05e71a
-#ifdef KERNEL_64_USERSPACE_32
05e71a
-	unsigned int pad;
05e71a
-#endif
05e71a
 	unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
05e71a
 };
05e71a
 
05e71a
-struct ebt_entry_watcher
05e71a
-{
05e71a
+struct ebt_entry_watcher {
05e71a
 	union {
05e71a
 		char name[EBT_FUNCTION_MAXNAMELEN];
05e71a
-		struct ebt_watcher *watcher;
05e71a
+		struct xt_target *watcher;
05e71a
 	} u;
05e71a
 	/* size of data */
05e71a
 	unsigned int watcher_size;
05e71a
-#ifdef KERNEL_64_USERSPACE_32
05e71a
-	unsigned int pad;
05e71a
-#endif
05e71a
 	unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
05e71a
 };
05e71a
 
05e71a
-struct ebt_entry_target
05e71a
-{
05e71a
+struct ebt_entry_target {
05e71a
 	union {
05e71a
 		char name[EBT_FUNCTION_MAXNAMELEN];
05e71a
-		struct ebt_target *target;
05e71a
+		struct xt_target *target;
05e71a
 	} u;
05e71a
 	/* size of data */
05e71a
 	unsigned int target_size;
05e71a
-#ifdef KERNEL_64_USERSPACE_32
05e71a
-	unsigned int pad;
05e71a
-#endif
05e71a
 	unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
05e71a
 };
05e71a
 
05e71a
 #define EBT_STANDARD_TARGET "standard"
05e71a
-struct ebt_standard_target
05e71a
-{
05e71a
+struct ebt_standard_target {
05e71a
 	struct ebt_entry_target target;
05e71a
 	int verdict;
05e71a
-#ifdef KERNEL_64_USERSPACE_32
05e71a
-	unsigned int pad;
05e71a
-#endif
05e71a
 };
05e71a
 
05e71a
 /* one entry */
05e71a
@@ -167,7 +158,7 @@ struct ebt_entry {
05e71a
 	/* this needs to be the first field */
05e71a
 	unsigned int bitmask;
05e71a
 	unsigned int invflags;
05e71a
-	uint16_t ethproto;
05e71a
+	__be16 ethproto;
05e71a
 	/* the physical in-dev */
05e71a
 	char in[IFNAMSIZ];
05e71a
 	/* the logical in-dev */
05e71a
@@ -202,6 +193,7 @@ struct ebt_entry {
05e71a
 #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1)
05e71a
 #define EBT_SO_GET_MAX          (EBT_SO_GET_INIT_ENTRIES+1)
05e71a
 
05e71a
+
05e71a
 /* blatently stolen from ip_tables.h
05e71a
  * fn returns 0 to continue iteration */
05e71a
 #define EBT_MATCH_ITERATE(e, fn, args...)                   \
05e71a
diff --git a/include/linux/types.h b/include/linux/types.h
05e71a
index 630cd3bb01f0a..23ea78fd1847a 100644
05e71a
--- a/include/linux/types.h
05e71a
+++ b/include/linux/types.h
05e71a
@@ -38,7 +38,7 @@ typedef __u32 __bitwise __wsum;
05e71a
  * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
05e71a
  * common 32/64-bit compat problems.
05e71a
  * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
05e71a
- * architectures) and to 8-byte boundaries on 64-bit architetures.  The new
05e71a
+ * architectures) and to 8-byte boundaries on 64-bit architectures.  The new
05e71a
  * aligned_64 type enforces 8-byte alignment so that structs containing
05e71a
  * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
05e71a
  * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
05e71a
-- 
05e71a
2.21.0
05e71a