aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNardi Ivan <nardi.ivan@gmail.com>2024-06-24 14:25:46 +0200
committerIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-06-25 16:39:45 +0200
commitb5afa165f0e799257a4e341e278290ff6c3568db (patch)
tree5ed5a8cdbb788ce3b4a3a42967dedb32745643a5
parent2daab3f24852ace8ad8d8f1a722bea0a62b9bcc4 (diff)
wireshark: extcap: restore filtering mechanism
-rw-r--r--example/ndpiReader.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 93b9f7640..ed6ed79e8 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -795,7 +795,7 @@ void extcap_dlts() {
struct ndpi_proto_sorter {
int id;
- char name[16];
+ char name[32];
};
/* ********************************** */
@@ -833,18 +833,23 @@ int cmpFlows(const void *_a, const void *_b) {
void extcap_config() {
int argidx = 0;
-#if 0
+
struct ndpi_proto_sorter *protos;
u_int ndpi_num_supported_protocols;
int i;
ndpi_proto_defaults_t *proto_defaults;
-#endif
+ NDPI_PROTOCOL_BITMASK all;
struct ndpi_detection_module_struct *ndpi_str = ndpi_init_detection_module(NULL);
-#if 0
+ if(!ndpi_str) exit(0);
+
+ NDPI_BITMASK_SET_ALL(all);
+ ndpi_set_protocol_detection_bitmask2(ndpi_str, &all);
+
+ ndpi_finalize_initialization(ndpi_str);
+
ndpi_num_supported_protocols = ndpi_get_ndpi_num_supported_protocols(ndpi_str);
proto_defaults = ndpi_get_proto_defaults(ndpi_str);
-#endif
/* -i <interface> */
printf("arg {number=%d}{call=-i}{display=Capture Interface}{type=string}{group=Live Capture}"
@@ -853,15 +858,14 @@ void extcap_config() {
printf("arg {number=%d}{call=-i}{display=Pcap File to Analyze}{type=fileselect}{mustexist=true}{group=Pcap}"
"{tooltip=The pcap file to analyze (if the interface is unspecified)}\n", argidx++);
-#if 0
- /* Removed as it breaks! extcap */
+
protos = (struct ndpi_proto_sorter*)ndpi_malloc(sizeof(struct ndpi_proto_sorter) * ndpi_num_supported_protocols);
if(!protos) exit(0);
printf("arg {number=%d}{call=--ndpi-proto-filter}{display=nDPI Protocol Filter}{type=selector}{group=Filter}"
"{tooltip=nDPI Protocol to be filtered}\n", argidx);
- printf("value {arg=%d}{value=%d}{display=%s}{default=true}\n", argidx, 0, "No nDPI filtering");
+ printf("value {arg=%d}{value=%d}{display=%s}{default=true}\n", argidx, (u_int32_t)-1, "No nDPI filtering");
for(i=0; i<(int) ndpi_num_supported_protocols; i++) {
protos[i].id = i;
@@ -875,7 +879,6 @@ void extcap_config() {
protos[i].name, protos[i].id);
ndpi_free(protos);
-#endif
ndpi_exit_detection_module(ndpi_str);