From ad6bfbad4d0b8ae6c0c6b2d58c68eee542110e8a Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Sun, 18 Dec 2022 09:10:57 +0100 Subject: Add protocol disabling feature (#1808) The application may enable only some protocols. Disabling a protocol means: *) don't register/use the protocol dissector code (if any) *) disable classification by-port for such a protocol *) disable string matchings for domains/certificates involving this protocol *) disable subprotocol registration (if any) This feature can be tested with `ndpiReader -B list_of_protocols_to_disable`. Custom protocols are always enabled. Technically speaking, this commit doesn't introduce any API/ABI incompatibility. However, calling `ndpi_set_protocol_detection_bitmask2()` is now mandatory, just after having called `ndpi_init_detection_module()`. Most of the diffs (and all the diffs in `/src/lib/protocols/`) are due to the removing of some function parameters. Fix the low level macro `NDPI_LOG`. This issue hasn't been detected sooner simply because almost all the code uses only the helpers `NDPI_LOG_*` --- src/lib/protocols/cpha.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lib/protocols/cpha.c') diff --git a/src/lib/protocols/cpha.c b/src/lib/protocols/cpha.c index d1dcc6f66..5874b0f9e 100644 --- a/src/lib/protocols/cpha.c +++ b/src/lib/protocols/cpha.c @@ -51,9 +51,8 @@ void ndpi_search_cpha(struct ndpi_detection_module_struct *ndpi_struct, struct n } -void init_cpha_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, - NDPI_PROTOCOL_BITMASK *detection_bitmask) { - ndpi_set_bitmask_protocol_detection("CPHA", ndpi_struct, detection_bitmask, *id, +void init_cpha_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id) { + ndpi_set_bitmask_protocol_detection("CPHA", ndpi_struct, *id, NDPI_PROTOCOL_CPHA, ndpi_search_cpha, NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD, /* TODO: ipv6 support? */ -- cgit v1.2.3