Skip to contentSkip to conversation

datatype: explicitly set missing datatypes for TYPE_CT_LABEL,TYPE_CT_EVENTBIT

PATCH In review Thomas Haller 2 participants 4 messages Sep 19, 2023 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 datatype: explicitly set missing datatypes for TYPE_CT_LABEL,TYPE_CT_EVENTBIT

It's not obvious that two enum values are missing (or why). Explicitly set the values to NULL, so we can see this more easily.

---
 src/datatype.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/datatype.c +3 -1
index 70c84846f70e..bb0c3cf79150 100644
@@ -65,6 +65,7 @@ static const struct datatype *datatypes[TYPE_MAX + 1] = {
 	[TYPE_CT_DIR]		= &ct_dir_type,
 	[TYPE_CT_STATUS]	= &ct_status_type,
 	[TYPE_ICMP6_TYPE]	= &icmp6_type_type,
+	[TYPE_CT_LABEL]		= NULL,
 	[TYPE_PKTTYPE]		= &pkttype_type,
 	[TYPE_ICMP_CODE]	= &icmp_code_type,
 	[TYPE_ICMPV6_CODE]	= &icmpv6_code_type,
@@ -72,8 +73,9 @@ static const struct datatype *datatypes[TYPE_MAX + 1] = {
 	[TYPE_DEVGROUP]		= &devgroup_type,
 	[TYPE_DSCP]		= &dscp_type,
 	[TYPE_ECN]		= &ecn_type,
-	[TYPE_FIB_ADDR]         = &fib_addr_type,
+	[TYPE_FIB_ADDR]		= &fib_addr_type,
 	[TYPE_BOOLEAN]		= &boolean_type,
+	[TYPE_CT_EVENTBIT]	= NULL,
 	[TYPE_IFNAME]		= &ifname_type,
 	[TYPE_IGMP_TYPE]	= &igmp_type_type,
 	[TYPE_TIME_DATE]	= &date_type,
Signature · 1 line
2.41.0
#1 lore raw

Hi Thomas,

Quoted 2 lines · Thomas Haller

It's not obvious that two enum values are missing (or why). Explicitly set the values to NULL, so we can see this more easily.

I think this is uncovering a bug with these selectors.

When concatenations are used, IIRC the delinerize path needs this.

TYPE_CT_EVENTBIT does not need this, because this is a statement to globally filter ctnetlink events events.

But TYPE_CT_LABEL is likely not working fine with concatenations.

Let me take a closer look.

Quoted 31 lines
---
 src/datatype.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/datatype.c +3 -1
index 70c84846f70e..bb0c3cf79150 100644
@@ -65,6 +65,7 @@ static const struct datatype *datatypes[TYPE_MAX + 1] = {
 	[TYPE_CT_DIR]		= &ct_dir_type,
 	[TYPE_CT_STATUS]	= &ct_status_type,
 	[TYPE_ICMP6_TYPE]	= &icmp6_type_type,
+	[TYPE_CT_LABEL]		= NULL,
 	[TYPE_PKTTYPE]		= &pkttype_type,
 	[TYPE_ICMP_CODE]	= &icmp_code_type,
 	[TYPE_ICMPV6_CODE]	= &icmpv6_code_type,
@@ -72,8 +73,9 @@ static const struct datatype *datatypes[TYPE_MAX + 1] = {
 	[TYPE_DEVGROUP]		= &devgroup_type,
 	[TYPE_DSCP]		= &dscp_type,
 	[TYPE_ECN]		= &ecn_type,
-	[TYPE_FIB_ADDR]         = &fib_addr_type,
+	[TYPE_FIB_ADDR]		= &fib_addr_type,
 	[TYPE_BOOLEAN]		= &boolean_type,
+	[TYPE_CT_EVENTBIT]	= NULL,
 	[TYPE_IFNAME]		= &ifname_type,
 	[TYPE_IGMP_TYPE]	= &igmp_type_type,
 	[TYPE_TIME_DATE]	= &date_type,
Signature · 1 line
2.41.0
#2 lore raw
Quoted 9 lines · Pablo Neira Ayuso

Hi Thomas,

Quoted 3 lines · Thomas Haller

It's not obvious that two enum values are missing (or why). Explicitly
set the values to NULL, so we can see this more easily.

I think this is uncovering a bug with these selectors.

Quoted 8 lines

When concatenations are used, IIRC the delinerize path needs this.

TYPE_CT_EVENTBIT does not need this, because this is a statement to globally filter ctnetlink events events.

But TYPE_CT_LABEL is likely not working fine with concatenations.

Let me take a closer look.

Hi Pablo,

Thank you.

FYI, I have a patch with a unit test that performs some consistency checks of the "datatypes" array. Only TYPE_CT_LABEL + TYPE_CT_EVENTBIT are missing.

You don't need to write a test about that. The test is however on top of "no recursive make" patches, which I will resent at a later time.

Thomas

Quoted 35 lines
Quoted 34 lines

---
 src/datatype.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
src/datatype.c +2 -0
index 70c84846f70e..bb0c3cf79150 100644
@@ -65,6 +65,7 @@ static const struct datatype *datatypes[TYPE_MAX
+ 1] = {
         [TYPE_CT_DIR]           = &ct_dir_type,
         [TYPE_CT_STATUS]        = &ct_status_type,
         [TYPE_ICMP6_TYPE]       = &icmp6_type_type,
+       [TYPE_CT_LABEL]         = NULL,
         [TYPE_PKTTYPE]          = &pkttype_type,
         [TYPE_ICMP_CODE]        = &icmp_code_type,

        [TYPE_ICMPV6_CODE]      = &icmpv6_code_type,

src/datatype.c +3 -1
@@ -72,8 +73,9 @@ static const struct datatype *datatypes[TYPE_MAX
+ 1] = {
         [TYPE_DEVGROUP]         = &devgroup_type,
         [TYPE_DSCP]             = &dscp_type,
         [TYPE_ECN]              = &ecn_type,
-       [TYPE_FIB_ADDR]         = &fib_addr_type,
+       [TYPE_FIB_ADDR]         = &fib_addr_type,
         [TYPE_BOOLEAN]          = &boolean_type,
+       [TYPE_CT_EVENTBIT]      = NULL,
         [TYPE_IFNAME]           = &ifname_type,
         [TYPE_IGMP_TYPE]        = &igmp_type_type,

        [TYPE_TIME_DATE]        = &date_type,

Signature · 1 line
2.41.0
#3 lore raw
Quoted 21 lines · Thomas Haller
Quoted 9 lines · Pablo Neira Ayuso

Hi Thomas,

Quoted 3 lines · Thomas Haller

It's not obvious that two enum values are missing (or why). Explicitly
set the values to NULL, so we can see this more easily.

I think this is uncovering a bug with these selectors.

Quoted 8 lines

When concatenations are used, IIRC the delinerize path needs this.

TYPE_CT_EVENTBIT does not need this, because this is a statement to globally filter ctnetlink events events.

But TYPE_CT_LABEL is likely not working fine with concatenations.

Let me take a closer look.

Hi Pablo,

Quoted 8 lines

Thank you.

FYI, I have a patch with a unit test that performs some consistency checks of the "datatypes" array. Only TYPE_CT_LABEL + TYPE_CT_EVENTBIT are missing.

You don't need to write a test about that. The test is however on top of "no recursive make" patches, which I will resent at a later time.

Thanks, I posted the fixes without unit tests:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/
https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/