diff mbox series

conntrack: fix zone sync issue

Message ID 20201019030422.396340-1-yang_y_yi@163.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series conntrack: fix zone sync issue | expand

Commit Message

yang_y_yi Oct. 19, 2020, 3:04 a.m. UTC
From: Yi Yang <yangyi01@inspur.com>

In some use cases, zone is used to differentiate different
conntrack state tables, so zone also should be synchronized
if it is set.

Signed-off-by: Yi Yang <yangyi01@inspur.com>
---
 include/network.h | 1 +
 src/build.c       | 3 +++
 src/parse.c       | 5 +++++
 3 files changed, 9 insertions(+)

Comments

Pablo Neira Ayuso Oct. 20, 2020, 10:57 a.m. UTC | #1
On Mon, Oct 19, 2020 at 11:04:22AM +0800, yang_y_yi@163.com wrote:
> From: Yi Yang <yangyi01@inspur.com>
> 
> In some use cases, zone is used to differentiate different
> conntrack state tables, so zone also should be synchronized
> if it is set.

Applied, thanks.
diff mbox series

Patch

diff --git a/include/network.h b/include/network.h
index 95aad82..20def34 100644
--- a/include/network.h
+++ b/include/network.h
@@ -232,6 +232,7 @@  enum nta_attr {
 	NTA_SNAT_IPV6,		/* uint32_t * 4 */
 	NTA_DNAT_IPV6,		/* uint32_t * 4 */
 	NTA_SYNPROXY,		/* struct nft_attr_synproxy */
+	NTA_ZONE,		/* uint16_t */
 	NTA_MAX
 };
 
diff --git a/src/build.c b/src/build.c
index 99ff230..4771997 100644
--- a/src/build.c
+++ b/src/build.c
@@ -315,6 +315,9 @@  void ct2msg(const struct nf_conntrack *ct, struct nethdr *n)
 	    nfct_attr_is_set(ct, ATTR_SYNPROXY_ITS) &&
 	    nfct_attr_is_set(ct, ATTR_SYNPROXY_TSOFF))
 		ct_build_synproxy(ct, n);
+
+	if (nfct_attr_is_set(ct, ATTR_ZONE))
+	    ct_build_u16(ct, ATTR_ZONE, n, NTA_ZONE);
 }
 
 static void
diff --git a/src/parse.c b/src/parse.c
index 7e524ed..e97a721 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -205,6 +205,11 @@  static struct ct_parser h[NTA_MAX] = {
 		.parse	= ct_parse_synproxy,
 		.size	= NTA_SIZE(sizeof(struct nta_attr_synproxy)),
 	},
+	[NTA_ZONE] = {
+		.parse	= ct_parse_u16,
+		.attr	= ATTR_ZONE,
+		.size	= NTA_SIZE(sizeof(uint16_t)),
+	},
 };
 
 static void