summaryrefslogtreecommitdiff
path: root/server/RouteController.cpp
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-01-24 09:18:13 +0900
committerLorenzo Colitti <lorenzo@google.com>2020-01-24 10:20:35 +0900
commit57d54681bd1e3549b1e94d26a8fbd5138b1614ed (patch)
treee3ebc5e42970d1ed8dbe68e302a385d5c43541f7 /server/RouteController.cpp
parent1d9f35adf646928f221bb2b7b3cadc5b6c22e71d (diff)
Tweak RTA_METRICS size calculation.
Use the more correct RTA_SPACE macro instead of manually calculating the size, and the more appropriate size_t type instead of int. Bug: 142892223 Test: covered by existing unit tests Change-Id: I74dd5c912e2a13721e1bd6c90df4a579e826805f
Diffstat (limited to 'server/RouteController.cpp')
-rw-r--r--server/RouteController.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index c4c3cfbe..c2163cd3 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -120,9 +120,10 @@ rtattr RTATTR_PRIO = { U16_RTA_LENGTH(sizeof(uint32_t)), RTA_PRIO
// One or more nested attributes in the RTA_METRICS attribute.
rtattr RTATTRX_MTU = { U16_RTA_LENGTH(sizeof(uint32_t)), RTAX_MTU};
+constexpr size_t RTATTRX_MTU_SIZE = RTA_SPACE(sizeof(uint32_t));
// The RTA_METRICS attribute itself.
-constexpr int RTATTR_METRICS_SIZE = sizeof(RTATTRX_MTU) + sizeof(uint32_t);
+constexpr size_t RTATTR_METRICS_SIZE = RTATTRX_MTU_SIZE;
rtattr RTATTR_METRICS = { U16_RTA_LENGTH(RTATTR_METRICS_SIZE), RTA_METRICS };
uint8_t PADDING_BUFFER[RTA_ALIGNTO] = {0, 0, 0, 0};