diff options
author | Luca Deri <deri@ntop.org> | 2024-10-27 08:17:27 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2024-10-27 08:17:27 +0100 |
commit | d5236c0aafe0b9622da752147ff4fbafd52e7582 (patch) | |
tree | 4a8c3e674ad93abbd3a431e49d4d43c7388f767c /src | |
parent | 925bd2f4823ead724d06edb9cfb2c42fe469f0cb (diff) |
Fixes TCP fingerprint calculation when multiple EOL are specified in TCP options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_main.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index ba766a57b..d8e46875f 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -6963,9 +6963,10 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str, options_fp_len += rc; - if(kind == 0) /* EOF */ - break; - else if(kind == 1) /* NOP */ + if(kind == 0) /* EOL */ { + i++; + continue; + } else if(kind == 1) /* NOP */ i++; else if((i+1) < options_len) { u_int8_t len = options[i+1]; @@ -6975,7 +6976,7 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str, #endif if(len == 0) - break; + continue; else if(kind == 8) { /* Timestamp: ignore it */ } else if(len > 2) { @@ -6995,6 +6996,10 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str, } } /* for */ +#ifdef DEBUG_TCP_OPTIONS + printf("Raw Options Fingerprint: %s\n", options_fp); +#endif + ndpi_sha256((const u_char*)options_fp, options_fp_len, sha_hash); snprintf(&fingerprint[fp_idx], sizeof(fingerprint)-fp_idx, "%02x%02x%02x%02x%02x%02x", |