Add safekeeping TTL value for Auto TTL

This commit is contained in:
ValdikSS 2021-12-25 13:47:13 +03:00
parent a5c2f9fac9
commit e1e09f9103

View File

@ -222,10 +222,16 @@ int tcp_get_auto_ttl(const uint8_t ttl, const uint8_t decrease_for) {
uint8_t ttl_of_fake_packet = 0;
if (ttl > 64 && ttl < 128) {
ttl_of_fake_packet = 128 - ttl - decrease_for;
/* Safekeeping */
if (128 - ttl > decrease_for + 1) {
ttl_of_fake_packet = 128 - ttl - decrease_for;
}
}
else if (ttl > 34 && ttl < 64) {
ttl_of_fake_packet = 64 - ttl - decrease_for;
/* Safekeeping */
if (64 - ttl > decrease_for + 1) {
ttl_of_fake_packet = 64 - ttl - decrease_for;
}
}
else {
ttl_of_fake_packet = 0;