aboutgitcodebugslistschat
path: root/tap.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-01-15 17:39:43 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-01-16 21:49:27 +0100
commita179ca6707b29cfc01371fb5636b2f49d263ab83 (patch)
treea783d015ca015059be6ce1b54e91565ef221c498 /tap.c
parentf60c85194b87c6cc182b9868c9e6a6b8ac1af48f (diff)
downloadpasst-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar
passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.gz
passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.bz2
passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.lz
passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.xz
passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.zst
passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.zip
treewide: Make a bunch of pointer variables pointers to const
Sufficiently recent cppcheck (I'm using 2.13.0) seems to have added another warning for pointer variables which could be pointer to const but aren't. Use this to make a bunch of variables const pointers where they previously weren't for no particular reason. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tap.c b/tap.c
index 2ceda8d..396dee7 100644
--- a/tap.c
+++ b/tap.c
@@ -600,10 +600,10 @@ static int tap4_handler(struct ctx *c, const struct pool *in,
resume:
for (seq_count = 0, seq = NULL; i < in->count; i++) {
size_t l2_len, l3_len, hlen, l4_len;
- struct ethhdr *eh;
+ const struct ethhdr *eh;
+ const struct udphdr *uh;
struct iphdr *iph;
- struct udphdr *uh;
- char *l4h;
+ const char *l4h;
packet_get(in, i, 0, 0, &l2_len);
@@ -765,9 +765,9 @@ resume:
for (seq_count = 0, seq = NULL; i < in->count; i++) {
size_t l4_len, plen, check;
struct in6_addr *saddr, *daddr;
+ const struct ethhdr *eh;
+ const struct udphdr *uh;
struct ipv6hdr *ip6h;
- struct ethhdr *eh;
- struct udphdr *uh;
uint8_t proto;
char *l4h;
@@ -936,7 +936,7 @@ static void tap_sock_reset(struct ctx *c)
void tap_handler_passt(struct ctx *c, uint32_t events,
const struct timespec *now)
{
- struct ethhdr *eh;
+ const struct ethhdr *eh;
ssize_t n, rem;
char *p;