]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Perf: fixed stupid allocation bug
authorMaria Matejka <mq@ucw.cz>
Thu, 7 Mar 2019 17:02:05 +0000 (18:02 +0100)
committerMaria Matejka <mq@ucw.cz>
Fri, 15 Mar 2019 15:34:26 +0000 (16:34 +0100)
proto/perf/perf.c

index 8412254a630490cc5bb6616c49a4d0a900a43f6e..bfc0f09eb3999a60a3505d99d2fcb70403eebdd7 100644 (file)
@@ -90,6 +90,8 @@ struct perf_random_routes {
   struct rta a;
 };
 
+static const uint perf_random_routes_size = sizeof(net_addr) + sizeof(rte *) + RTA_MAX_SIZE;
+
 static inline s64 timediff(struct timespec *begin, struct timespec *end)
 { return (end->tv_sec - begin->tv_sec) * (s64) 1000000000 + end->tv_nsec - begin->tv_nsec; }
 
@@ -124,7 +126,7 @@ perf_loop(void *data)
   struct perf_proto *p = data;
 
   const uint N = 1U << p->exp;
-  const uint offset = sizeof(net_addr) + RTA_MAX_SIZE;
+  const uint offset = perf_random_routes_size;
 
   if (!p->run) {
     ASSERT(p->data == NULL);