]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: net_helper: prepare the ip.fp() converter to support more options
authorWilly Tarreau <w@1wt.eu>
Thu, 1 Jan 2026 09:15:54 +0000 (10:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 1 Jan 2026 09:19:20 +0000 (10:19 +0100)
It can make sense to support extra components in the fingerprint to ease
configuration, so let's change the 0/1 value to a bit field. We also turn
the current 1 (TCP options list) to 2 so that we'll reuse 1 for the TTL.

doc/configuration.txt
src/net_helper.c

index 7f88178fab707be1b7009ffe76c4dbc7af4f303f..0f865d8d64e5ad94b4b998fec2f887e17d8f6006 100644 (file)
@@ -21137,10 +21137,14 @@ ip.fp([<mode>])
     - byte 3..4: tcp.win
     - byte 5..6: tcp.options.mss, or zero if absent
 
-  When the <mode> argument is not set or is zero, the fingerprint is solely
-  made of the 7 bytes described above. When the <mode> is 1, it starts by the
-  7-byte block above, and is followed by the list of TCP option kinds, for 0
-  to 40 extra bytes, as returned by "tcp.options_list".
+  The <mode> argument permits to append more information to the fingerprint. By
+  default, when the <mode> argument is not set or is zero, the fingerprint is
+  solely made of the 7 bytes described above. If <mode> is specified as another
+  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:
+    -   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
 
   Example:
 
index a3181fbe347f8e39afb5803afc36292c4aa8a8e9..4a187b37504bf21ef8b6066c6797b95b1a039ab8 100644 (file)
@@ -776,7 +776,7 @@ static int sample_conv_ip_fp(const struct arg *arg_p, struct sample *smp, void *
                        break;
 
                /* option is complete, take a copy of it */
-               if (mode > 0)
+               if (mode & 2) // mode & 2: append tcp.options_list
                        trash->area[trash->data++] = smp->data.u.str.area[ofs];
 
                if (smp->data.u.str.area[ofs] == 2 /* MSS */) {