Blame SOURCES/0006-nft-add-type-field-to-builtin_table.patch

8cce6c
From c900978466fc50bee651f83eab8fd598b7f88183 Mon Sep 17 00:00:00 2001
8cce6c
From: Pablo Neira Ayuso <pablo@netfilter.org>
8cce6c
Date: Sat, 17 Nov 2018 18:10:15 +0100
8cce6c
Subject: [PATCH] nft: add type field to builtin_table
8cce6c
8cce6c
Use enum nft_table_type to set the new type field in the structure that
8cce6c
define tables.
8cce6c
8cce6c
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
8cce6c
(cherry picked from commit 9847abe6fbb91621f6494df8243ff96f04efdc4a)
8cce6c
Signed-off-by: Phil Sutter <psutter@redhat.com>
8cce6c
---
8cce6c
 iptables/nft.c | 8 ++++++++
8cce6c
 iptables/nft.h | 1 +
8cce6c
 2 files changed, 9 insertions(+)
8cce6c
8cce6c
diff --git a/iptables/nft.c b/iptables/nft.c
8cce6c
index 36529048a0ca6..f0a60e1f568af 100644
8cce6c
--- a/iptables/nft.c
8cce6c
+++ b/iptables/nft.c
8cce6c
@@ -379,6 +379,7 @@ static int batch_rule_add(struct nft_handle *h, enum obj_update_type type,
8cce6c
 struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
8cce6c
 	[NFT_TABLE_RAW] = {
8cce6c
 		.name	= "raw",
8cce6c
+		.type	= NFT_TABLE_RAW,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name	= "PREROUTING",
8cce6c
@@ -396,6 +397,7 @@ struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
8cce6c
 	},
8cce6c
 	[NFT_TABLE_MANGLE] = {
8cce6c
 		.name	= "mangle",
8cce6c
+		.type	= NFT_TABLE_MANGLE,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name	= "PREROUTING",
8cce6c
@@ -431,6 +433,7 @@ struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
8cce6c
 	},
8cce6c
 	[NFT_TABLE_FILTER] = {
8cce6c
 		.name	= "filter",
8cce6c
+		.type	= NFT_TABLE_FILTER,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name	= "INPUT",
8cce6c
@@ -454,6 +457,7 @@ struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
8cce6c
 	},
8cce6c
 	[NFT_TABLE_SECURITY] = {
8cce6c
 		.name	= "security",
8cce6c
+		.type	= NFT_TABLE_SECURITY,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name	= "INPUT",
8cce6c
@@ -477,6 +481,7 @@ struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
8cce6c
 	},
8cce6c
 	[NFT_TABLE_NAT] = {
8cce6c
 		.name	= "nat",
8cce6c
+		.type	= NFT_TABLE_NAT,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name	= "PREROUTING",
8cce6c
@@ -511,6 +516,7 @@ struct builtin_table xtables_ipv4[NFT_TABLE_MAX] = {
8cce6c
 struct builtin_table xtables_arp[NFT_TABLE_MAX] = {
8cce6c
 	[NFT_TABLE_FILTER] = {
8cce6c
 	.name   = "filter",
8cce6c
+	.type	= NFT_TABLE_FILTER,
8cce6c
 	.chains = {
8cce6c
 			{
8cce6c
 				.name   = "INPUT",
8cce6c
@@ -533,6 +539,7 @@ struct builtin_table xtables_arp[NFT_TABLE_MAX] = {
8cce6c
 struct builtin_table xtables_bridge[NFT_TABLE_MAX] = {
8cce6c
 	[NFT_TABLE_FILTER] = {
8cce6c
 		.name = "filter",
8cce6c
+		.type	= NFT_TABLE_FILTER,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name   = "INPUT",
8cce6c
@@ -556,6 +563,7 @@ struct builtin_table xtables_bridge[NFT_TABLE_MAX] = {
8cce6c
 	},
8cce6c
 	[NFT_TABLE_NAT] = {
8cce6c
 		.name = "nat",
8cce6c
+		.type	= NFT_TABLE_NAT,
8cce6c
 		.chains = {
8cce6c
 			{
8cce6c
 				.name   = "PREROUTING",
8cce6c
diff --git a/iptables/nft.h b/iptables/nft.h
8cce6c
index 6229221bd51f7..85c894e80e02e 100644
8cce6c
--- a/iptables/nft.h
8cce6c
+++ b/iptables/nft.h
8cce6c
@@ -23,6 +23,7 @@ struct builtin_chain {
8cce6c
 
8cce6c
 struct builtin_table {
8cce6c
 	const char *name;
8cce6c
+	enum nft_table_type type;
8cce6c
 	struct builtin_chain chains[NF_INET_NUMHOOKS];
8cce6c
 	bool initialized;
8cce6c
 	struct nftnl_chain_list *chain_cache;
8cce6c
-- 
8cce6c
2.20.1
8cce6c