Closed redapplesonly closed 4 years ago
Besides the fact that you don't check any return value, the code looks good so far
Thanks Luca, I'll revise the code to check the return values; perhaps that will show why my detection module can't recognize any non-customized protocols. I hope so. :)
Is there no way to export the non-customized (default) protocols into a protocol file? Many thanks!
@redapplesonly this is not possible and will not solve your issue. Your issue root cause is probably how you feed packet to process function or how you build your packet to flow aggregation.
If you cannot share your code example here, I advice you to have a look at ndpiSimpleIntegration.c under example directory and make sure you follow the same logic. The code is simpler than reader example as a starting point.
Here some hints:
Hope this helps.
BR
Excellent, thank you, BR. This is solid, useful advice, and I appreciate you taking the time to explain it to me, far more than you can know. I'll work through your checklist. Thank you!
I have written my first program using nDPI, which captures live packets and sends them to nDPI for application/protocol identification. (I am working on Ubuntu 18.04, using GCC as a complier. nDPI version is 3.2)
I have the oddest issue with my code... When nDPI inspects my traffic, the
ndpi_detection_process_packet()
function always considers all packets to be "Unknown," meaning thestruct ndpi_protocol
returned by the function always looks like this:At first, I assumed my code had a bug in feeding packets to
ndpi_detection_process_packet()
. But then, just for fun, I added this very simple protocols file to mystruct ndpi_detection_module_struct
:When I ran the code again, nDPI could successfully recognize every packet that was HTTP or iPerf3, but nothing else. Its like the protocol library within my implementation is blank, except for the protocols that I supplement with my protocols file.
I still think I must have some flaw in my implementation, and I will continue to search for it. But I can't help but ask... if my code will only recognize protocols listed in the protocol file, can I make use of that as a workaround? Is there some way to export nDPI's default protocol file, which I could then feed to my code?
Unfortunately, I cannot post my project to this forum. I suspect that my code's problem is in my
struct ndpi_detection_module_struct
, and I'll post the code that initializes it below. It should look familiar, as it was, ah, "borrowed" from ndpiReader.c. Thank you for any advice you can offer.