From 61d6c3834de32c0ff5808c93da94b2b30b4791c8 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Mon, 12 Nov 2018 14:40:41 +0100 Subject: xtables: add 'printf' attribute to xlate_add This allows gcc to check format string vs. passed arguments. Fix the fallout from this as well, typical warning produced is: libebt_mark_m.c:112:28: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=] xt_xlate_add(xl, "and 0x%x %s0 ", info->mask, ... ~^ ~~~~~~~~~~ so add the required casts or fixup format strings as needed. libxt_conntrack also passed an unneeded argument (port), so remove that. Signed-off-by: Florian Westphal --- extensions/libxt_hashlimit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'extensions/libxt_hashlimit.c') diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index 7d78d852..f3b6e043 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -1221,7 +1221,7 @@ static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg, _rates[i].mult / avg < _rates[i].mult % avg) break; - xt_xlate_add(xl, " %llu/%s ", + xt_xlate_add(xl, " %" PRIu64 "/%s ", _rates[i-1].mult / avg, _rates[i-1].name); } @@ -1354,7 +1354,7 @@ static int hashlimit_mt_xlate(struct xt_xlate *xl, const char *name, else { print_packets_rate_xlate(xl, cfg->avg, revision); if (cfg->burst != XT_HASHLIMIT_BURST) - xt_xlate_add(xl, "burst %lu packets", cfg->burst); + xt_xlate_add(xl, "burst %" PRIu64 " packets", (uint64_t)cfg->burst); } xt_xlate_add(xl, "}"); @@ -1372,7 +1372,7 @@ static int hashlimit_xlate(struct xt_xlate *xl, ret = hashlimit_mode_xlate(xl, info->cfg.mode, NFPROTO_IPV4, 32, 32); xt_xlate_add(xl, " timeout %us limit rate", info->cfg.expire / 1000); print_packets_rate_xlate(xl, info->cfg.avg, 1); - xt_xlate_add(xl, " burst %lu packets", info->cfg.burst); + xt_xlate_add(xl, " burst %u packets", info->cfg.burst); xt_xlate_add(xl, "}"); return ret; -- cgit v1.2.3