]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: quic: 32bits build broken by wrong integer conversions for printf()
authorFrederic Lecaille <flecaille@haproxy.com>
Mon, 26 Aug 2024 09:18:15 +0000 (11:18 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 26 Aug 2024 09:21:48 +0000 (11:21 +0200)
Since these commits the 32bits build is broken due to several errors as follow:

CC      src/quic_cli.o
src/quic_cli.c: In function ‘dump_quic_full’:
src/quic_cli.c:285:94: error: format ‘%ld’ expects argument of type ‘long int’,
        but argument 5 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
  285 |                         chunk_appendf(&trash, "  [initl] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n",
      |                                                                                            ~~^
      |                                                                                              |
      |                                                                                              long int
      |                                                                                            %lld
  286 |                                       pktns->rx.arngs.sz, pktns->tx.in_flight,
  287 |                                       pktns->tx.in_flight * 100 / qc->path->cwnd);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                 |
      |                                                                 uint64_t {aka long long unsigned int}

Replace several %ld by %llu with ull as printf conversion in quic_clic.c and a
%ld by %lld with (long long) as printf conversion in quic_cc_cubic.c.

Thank you to Ilya (@chipitsine) for having reported this issue in GH #2689.

Must be backported to 3.0.

src/quic_cc_cubic.c
src/quic_cli.c

index 898476a2d319e5997b004fe7ab4f98868b902824..bc9410af9c5270a51a5dac91b97e87b56b1cb72b 100644 (file)
@@ -667,9 +667,9 @@ static void quic_cc_cubic_state_cli(struct buffer *buf, const struct quic_cc_pat
 {
        struct cubic *c = quic_cc_priv(&path->cc);
 
-       chunk_appendf(buf, "  cc: state=%s ssthresh=%u K=%u last_w_max=%u wdiff=%ld\n",
+       chunk_appendf(buf, "  cc: state=%s ssthresh=%u K=%u last_w_max=%u wdiff=%lld\n",
                      quic_cc_state_str(c->state), c->ssthresh, c->K, c->last_w_max,
-                     (int64_t)(path->cwnd - c->last_w_max));
+                     (long long)(path->cwnd - c->last_w_max));
 }
 
 struct quic_cc_algo quic_cc_algo_cubic = {
index 3a1923e6c42f5fcbd4d06d9d42e386cd4a1e0874..6d34a83126a3837111f0515bd78ffedb56240908 100644 (file)
@@ -282,23 +282,23 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc)
        if (ctx->fields & QUIC_DUMP_FLD_PKTNS) {
                pktns = qc->ipktns;
                if (pktns) {
-                       chunk_appendf(&trash, "  [initl] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n",
+                       chunk_appendf(&trash, "  [initl] rx.ackrng=%-6zu tx.inflight=%-6zu(%llu%%)\n",
                                      pktns->rx.arngs.sz, pktns->tx.in_flight,
-                                     pktns->tx.in_flight * 100 / qc->path->cwnd);
+                                     (ull)pktns->tx.in_flight * 100 / qc->path->cwnd);
                }
 
                pktns = qc->hpktns;
                if (pktns) {
-                       chunk_appendf(&trash, "  [hndshk] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n",
+                       chunk_appendf(&trash, "  [hndshk] rx.ackrng=%-6zu tx.inflight=%-6zu(%llu%%)\n",
                                      pktns->rx.arngs.sz, pktns->tx.in_flight,
-                                     pktns->tx.in_flight * 100 / qc->path->cwnd);
+                                     (ull)pktns->tx.in_flight * 100 / qc->path->cwnd);
                }
 
                pktns = qc->apktns;
                if (pktns) {
-                       chunk_appendf(&trash, "  [01rtt] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n",
+                       chunk_appendf(&trash, "  [01rtt] rx.ackrng=%-6zu tx.inflight=%-6zu(%llu%%)\n",
                                      pktns->rx.arngs.sz, pktns->tx.in_flight,
-                                     pktns->tx.in_flight * 100 / qc->path->cwnd);
+                                     (ull)pktns->tx.in_flight * 100 / qc->path->cwnd);
                }
        }