ntop / nDPI

Open Source Deep Packet Inspection Software Toolkit
http://www.ntop.org
GNU Lesser General Public License v3.0
3.86k stars 902 forks source link

Add memmem() implementation #2378

Closed 0xA50C1A1 closed 7 months ago

0xA50C1A1 commented 7 months ago

Please sign (check) the below before submitting the Pull Request:

Describe changes:

Although this implementation has O(n*m) complexity in the worst case, in the typical nDPI scenario (searching for a string or byte sequence in a payload with a typical maximum length of 1460/1472 bytes) it performed much better than the other implementations.

Here is the result of a small benchmark searching for the string eso.live in an 852 byte long array (packet from The Elder Scrolls Online pcap sample):

image

0xA50C1A1 commented 7 months ago

Uh, I don't think it's related to my PR:

protocols/http.c:68:80: error: unused parameter ‘ndpi_struct’ [-Werror=unused-parameter]
   68 | static void ndpi_set_binary_data_transfer(struct ndpi_detection_module_struct *ndpi_struct,
      |      
utoni commented 7 months ago

The error was introduced by a recent commit to dev. ;)

IvanNardi commented 7 months ago

@0xA50C1A1 , could you rebase, please?

0xA50C1A1 commented 7 months ago

@0xA50C1A1 , could you rebase, please?

Done.

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

IvanNardi commented 7 months ago

Thank you