From 627e18fa8ad000ed92405cff3a88c36fd5f3027e Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 21 Oct 2021 09:41:13 +0200 Subject: passt: Add cppcheck target, test, and address resulting warnings ...mostly false positives, but a number of very relevant ones too, in tcp_get_sndbuf(), tcp_conn_from_tap(), and siphash PREAMBLE(). Signed-off-by: Stefano Brivio --- conf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 7dd213d..8ec67fc 100644 --- a/conf.c +++ b/conf.c @@ -678,7 +678,7 @@ pasta_opts: void conf_print(struct ctx *c) { - char buf6[INET6_ADDRSTRLEN], buf4[INET_ADDRSTRLEN], ifn[IFNAMSIZ]; + char buf4[INET_ADDRSTRLEN], ifn[IFNAMSIZ]; int i; if (c->mode == MODE_PASTA) { @@ -723,6 +723,8 @@ void conf_print(struct ctx *c) } if (c->v6) { + char buf6[INET6_ADDRSTRLEN]; + if (!c->no_ndp && !c->no_dhcpv6) info("NDP/DHCPv6:"); else if (!c->no_ndp) @@ -1013,7 +1015,7 @@ void conf(struct ctx *c, int argc, char **argv) errno = 0; mask = strtol(optarg, NULL, 0); - if (mask >= 0 && mask <= 32 && !errno) { + if (mask > 0 && mask <= 32 && !errno) { c->mask4 = htonl(0xffffffff << (32 - mask)); break; } -- cgit v1.2.3