Hello,
Here is a simple patch to add remaining information to peer stick-table
definition message useful for external applications to discover haproxy
peer stick-table configurations.
Regards,
Fred.
>From 733ecc558cc47b9c4d94ef2b316c6e7b3bf067a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= <flecai...@haproxy.com>
Date: Thu, 6 Jul 2017 15:02:16 +0200
Subject: [PATCH] MINOR: peers: Add additional information to stick-table
definition messages.
With this patch additional information are added to stick-table definition
messages so that to make external application capable of learning peer
stick-table configurations. First stick-table entries duration is added
followed by the frequency counters type IDs and values.
May be backported to 1.7 and 1.6.
---
src/peers.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/peers.c b/src/peers.c
index 643b8c5..1ac3bad 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -422,6 +422,25 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
}
intencode(data, &cursor);
+ /* Encode stick-table entries duration. */
+ intencode(st->table->expire, &cursor);
+
+ /* Encode the frequency counters periods. */
+ for (data_type = 0 ; data_type < STKTABLE_DATA_TYPES ; data_type++) {
+ if (st->table->data_ofs[data_type]) {
+ switch (stktable_data_types[data_type].std_type) {
+ case STD_T_SINT:
+ case STD_T_UINT:
+ case STD_T_ULL:
+ continue;
+ case STD_T_FRQP:
+ intencode(data_type, &cursor);
+ intencode(st->table->data_arg[data_type].u, &cursor);
+ break;
+ }
+ }
+ }
+
/* Compute datalen */
datalen = (cursor - datamsg);
--
2.1.4