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_conntrack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'extensions/libxt_conntrack.c') diff --git a/extensions/libxt_conntrack.c b/extensions/libxt_conntrack.c index daa8c15a..1817d335 100644 --- a/extensions/libxt_conntrack.c +++ b/extensions/libxt_conntrack.c @@ -1271,9 +1271,9 @@ static int _conntrack3_mt_xlate(struct xt_xlate *xl, sinfo->invert_flags & XT_CONNTRACK_EXPIRES ? "!= " : ""); if (sinfo->expires_max == sinfo->expires_min) - xt_xlate_add(xl, "%lu", sinfo->expires_min); + xt_xlate_add(xl, "%u", sinfo->expires_min); else - xt_xlate_add(xl, "%lu-%lu", sinfo->expires_min, + xt_xlate_add(xl, "%u-%u", sinfo->expires_min, sinfo->expires_max); space = " "; } @@ -1365,7 +1365,7 @@ static int _conntrack3_mt_xlate(struct xt_xlate *xl, if (sinfo->match_flags & XT_CONNTRACK_REPLDST_PORT) { xt_xlate_add(xl, "%sct reply proto-dst %s", space, sinfo->invert_flags & XT_CONNTRACK_REPLDST_PORT ? - "!= " : "", sinfo->repldst_port); + "!= " : ""); if (sinfo->repldst_port == sinfo->repldst_port_high) xt_xlate_add(xl, "%u", sinfo->repldst_port); else -- cgit v1.2.3