betolj / ndpi-netfilter

GNU General Public License v2.0
126 stars 69 forks source link

main.c bug #14

Closed adrienb4 closed 8 years ago

adrienb4 commented 8 years ago

I have added a new NDPI_SERVICE in 'ndpi_protocol_ids.h' (like wikipedia and HTTP based protocol). This service is the last implemented (#define NDPI_LAST_IMPLEMENTED_PROTOCOL 190).

If you build nDPI for iptables with your tool, this service is never matching because http protocol is not added.

In the current loop, the last protocol/service is never executed for added or not http support protocol

To correct this, apply this path in 'main.c' file (L787) :

        for (i = 0; i < NDPI_LAST_IMPLEMENTED_PROTOCOL +1; i++){
                atomic_set (&protocols_cnt[i], 0);

                // Set HTTP based protocols
                if ((i > 118 && i < 127) || (i > 139 && i < 146) || (i > 175 && i < 182 ) || i == 70 || i == 133) nfndpi_protocols_http[i]=1;
                else nfndpi_protocols_http[i]=0;
        }
adrienb4 commented 8 years ago

How does this fix the problem? In this case, the last protocol will never executed :/

adrienb4 commented 8 years ago

Sorry I think I deleted your comment :/

betolj commented 8 years ago

Dont worry, I removed last comment. I will fix later. Thanks

betolj commented 8 years ago

Fix applied