Skip to contentSkip to conversation

datatype: initialize TYPE_CT_EVENTBIT slot in datatype array

PATCH New Pablo Neira Ayuso 1 participant 1 message Sep 19, 2023 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 datatype: initialize TYPE_CT_EVENTBIT slot in datatype array

Matching on ct event makes no sense since this is mostly used as statement to globally filter out ctnetlink events, but do not crash if it is used from concatenations.

Add the missing slot in the datatype array so this does not crash.

Fixes 2595b9ad6840 ("ct: add conntrack event mask support")
---
 include/ct.h   | 1 +
 src/ct.c       | 2 +-
 src/datatype.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
include/ct.h +1 -0
index aa0504c5ace7..0a705fd06ee1 100644
@@ -40,5 +40,6 @@ extern const struct datatype ct_dir_type;
 extern const struct datatype ct_state_type;
 extern const struct datatype ct_status_type;
 extern const struct datatype ct_label_type;
+extern const struct datatype ct_event_type;
 
 #endif /* NFTABLES_CT_H */
src/ct.c +1 -1
index d7dec25559b3..b2635543e6ec 100644
@@ -132,7 +132,7 @@ static const struct symbol_table ct_events_tbl = {
 	},
 };
 
-static const struct datatype ct_event_type = {
+const struct datatype ct_event_type = {
 	.type		= TYPE_CT_EVENTBIT,
 	.name		= "ct_event",
 	.desc		= "conntrack event bits",
src/datatype.c +1 -0
index ee0e97014185..14d5a0e60146 100644
@@ -75,6 +75,7 @@ static const struct datatype *datatypes[TYPE_MAX + 1] = {
 	[TYPE_ECN]		= &ecn_type,
 	[TYPE_FIB_ADDR]         = &fib_addr_type,
 	[TYPE_BOOLEAN]		= &boolean_type,
+	[TYPE_CT_EVENTBIT]	= &ct_event_type,
 	[TYPE_IFNAME]		= &ifname_type,
 	[TYPE_IGMP_TYPE]	= &igmp_type_type,
 	[TYPE_TIME_DATE]	= &date_type,
Signature · 1 line
2.30.2