aboutgitcodebugslistschat
path: root/ndp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-21 09:41:13 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-21 09:41:13 +0200
commit627e18fa8ad000ed92405cff3a88c36fd5f3027e (patch)
tree5caf72002139dd6bc80cd424de1730f8602cbb9d /ndp.c
parentc3f8e4d2cd55e57419478ff849265d1e342e7990 (diff)
downloadpasst-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.gz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.bz2
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.lz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.xz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.zst
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'ndp.c')
-rw-r--r--ndp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ndp.c b/ndp.c
index 5fa2bff..3a766ec 100644
--- a/ndp.c
+++ b/ndp.c
@@ -91,7 +91,7 @@ int ndp(struct ctx *c, struct ethhdr *eh, size_t len)
memcpy(p, c->mac, ETH_ALEN);
p += 6;
} else if (ih->icmp6_type == RS) {
- size_t len = 0;
+ size_t dns_s_len = 0;
int i, n;
if (c->no_ra)
@@ -139,7 +139,7 @@ int ndp(struct ctx *c, struct ethhdr *eh, size_t len)
}
for (n = 0; *c->dns_search[n].n; n++)
- len += strlen(c->dns_search[n].n) + 2;
+ dns_s_len += strlen(c->dns_search[n].n) + 2;
if (len) {
*p++ = 31; /* DNSSL */
*p++ = (len + 8 - 1) / 8 + 1; /* length */
@@ -163,8 +163,8 @@ int ndp(struct ctx *c, struct ethhdr *eh, size_t len)
*(p++) = 0;
}
- memset(p, 0, 8 - len % 8); /* padding */
- p += 8 - len % 8;
+ memset(p, 0, 8 - dns_s_len % 8); /* padding */
+ p += 8 - dns_s_len % 8;
}
*p++ = 1; /* source ll */