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

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