MINOR: net_helper: add an option to ip.fp() to append the TTL to the fingerprint

With mode value 1, the TTL will be appended immediately after the 7 bytes,
making it a 8-byte fingerprint.
This commit is contained in:
Willy Tarreau 2026-01-01 10:19:48 +01:00
parent 2c317cfed7
commit 70ffae3614
2 changed files with 4 additions and 0 deletions

View file

@ -21143,6 +21143,7 @@ ip.fp([<mode>])
value, it then corresponds to the sum of the following values, and the
respective components will be concatenated to the fingerprint, in the order
below:
- 1: the received TTL value is appended to the fingerprint (1 byte)
- 2: the list of TCP option kinds, as returned by "tcp.options_list",
made of 0 to 40 extra bytes, is appended to the fingerprint

View file

@ -722,6 +722,9 @@ static int sample_conv_ip_fp(const struct arg *arg_p, struct sample *smp, void *
/* store the TOS in the FP's first byte */
trash->area[0] = iptos;
if (mode & 1) // append TTL
trash->area[trash->data++] = ipttl;
/* keep only two bits for TTL: <=32, <=64, <=128, <=255 */
ipttl = (ipttl > 64) ? ((ipttl > 128) ? 3 : 2) : ((ipttl > 32) ? 1 : 0);