From: Aurelien DARRAGON Date: Fri, 14 Jun 2024 16:01:45 +0000 (+0200) Subject: BUG/MINOR: log: fix broken '+bin' logformat node option X-Git-Tag: v3.1-dev2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0030f722a2fa574d1e7d90e6f242e4b6a5ace355;p=thirdparty%2Fhaproxy.git BUG/MINOR: log: fix broken '+bin' logformat node option In 12d08cf912 ("BUG/MEDIUM: log: don't ignore disabled node's options"), while trying to restore historical node option inheritance behavior, I broke the '+bin' logformat node option recently introduced in b7c3d8c87c ("MINOR: log: add +bin logformat node option"). Indeed, because of 12d08cf912, LOG_OPT_BIN is not set anymore on individual nodes even if it was set globally, making the feature unusable. ('+bin' is also used for binary cbor encoding) What I should have done instead is include LOG_OPT_BIN in the options inherited from global ones. This is what's being done in this commit. Misleading comment was adjusted. It must be backported in 3.0 with 12d08cf912. --- diff --git a/src/log.c b/src/log.c index 42b5acad5c..a58c6fc3cf 100644 --- a/src/log.c +++ b/src/log.c @@ -969,14 +969,17 @@ static int lf_expr_postcheck_node_opt(struct lf_expr *lf_expr, struct logformat_ * Also, ensure we don't mix encoding types, global setting * prevails over per-node one. * - * Finally, ignore LOG_OPT_BIN since it is a global-only option + * Finally, only consider LOG_OPT_BIN if set globally + * (it is a global-only option) */ if (lf_expr->nodes.options & LOG_OPT_ENCODE) { node->options &= ~(LOG_OPT_BIN | LOG_OPT_ENCODE); - node->options |= (lf_expr->nodes.options & LOG_OPT_ENCODE); + node->options |= (lf_expr->nodes.options & (LOG_OPT_BIN | LOG_OPT_ENCODE)); } - else + else { node->options &= ~LOG_OPT_BIN; + node->options |= (lf_expr->nodes.options & LOG_OPT_BIN); + } _lf_expr_postcheck_node_opt(&node->options, lf_expr->nodes.options);