aboutgitcodebugslistschat
path: root/udp.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 /udp.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 'udp.c')
-rw-r--r--udp.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/udp.c b/udp.c
index 2f79297..3b8a70a 100644
--- a/udp.c
+++ b/udp.c
@@ -616,9 +616,9 @@ static void udp_sock_handler_splice(struct ctx *c, union epoll_ref ref,
if (ref.r.p.udp.udp.splice == UDP_TO_NS ||
ref.r.p.udp.udp.splice == UDP_TO_INIT) {
for (i = 0; i < n; i++) {
- struct msghdr *mh = &udp_splice_mmh_send[i].msg_hdr;
+ struct msghdr *mh_s = &udp_splice_mmh_send[i].msg_hdr;
- mh->msg_iov->iov_len = udp_splice_mmh_recv[i].msg_len;
+ mh_s->msg_iov->iov_len = udp_splice_mmh_recv[i].msg_len;
}
sendmmsg(s, udp_splice_mmh_send, n, MSG_NOSIGNAL);
@@ -626,9 +626,9 @@ static void udp_sock_handler_splice(struct ctx *c, union epoll_ref ref,
}
for (i = 0; i < n; i++) {
- struct msghdr *mh = &udp_splice_mmh_sendto[i].msg_hdr;
+ struct msghdr *mh_s = &udp_splice_mmh_sendto[i].msg_hdr;
- mh->msg_iov->iov_len = udp_splice_mmh_recv[i].msg_len;
+ mh_s->msg_iov->iov_len = udp_splice_mmh_recv[i].msg_len;
}
if (v6) {
@@ -710,8 +710,6 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
else
b->ip6h.saddr = c->addr6_ll;
- b->ip6h.saddr = c->gw6;
-
udp_tap_map[V6][src].ts_local = now->tv_sec;
if (IN6_IS_ADDR_LOOPBACK(&b->s_in6.sin6_addr))
@@ -1000,11 +998,11 @@ int udp_tap_handler(struct ctx *c, int af, void *addr,
}
for (i = 0; i < count; i++) {
- struct udphdr *uh;
+ struct udphdr *uh_send;
- uh = (struct udphdr *)(msg[i].pkt_buf_offset + pkt_buf);
- m[i].iov_base = (char *)(uh + 1);
- m[i].iov_len = msg[i].l4_len - sizeof(*uh);
+ uh_send = (struct udphdr *)(msg[i].pkt_buf_offset + pkt_buf);
+ m[i].iov_base = (char *)(uh_send + 1);
+ m[i].iov_len = msg[i].l4_len - sizeof(*uh_send);
mm[i].msg_hdr.msg_name = sa;
mm[i].msg_hdr.msg_namelen = sl;