From 7a9203dbfd4ad95f3cc40e122e520ee363d38825 Mon Sep 17 00:00:00 2001 From: Piotrek Zadroga Date: Wed, 22 Nov 2023 16:57:03 +0100 Subject: [#3074] addressed review comments --- src/lib/dhcp/option_classless_static_route.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/dhcp/option_classless_static_route.cc b/src/lib/dhcp/option_classless_static_route.cc index 5d3620386f..dd032dbb70 100644 --- a/src/lib/dhcp/option_classless_static_route.cc +++ b/src/lib/dhcp/option_classless_static_route.cc @@ -119,7 +119,7 @@ OptionClasslessStaticRoute::encodeDestinationDescriptor(const StaticRouteTuple& uint8_t OptionClasslessStaticRoute::calcSignificantOctets(const uint8_t& mask_width) { - return (mask_width / 8 + (mask_width % 8 != 0)); + return ((mask_width + 7) / 8); } void @@ -129,7 +129,7 @@ OptionClasslessStaticRoute::calcDataLen() { // 1-5 octets of destination descriptor len += calcSignificantOctets(std::get<1>(route)) + 1; // IP address of the router - len += 4; + len += V4ADDRESS_LEN; } data_len_ = len; -- cgit v1.2.3