aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-10-01 19:20:02 +0200
committerNeale Ranns <neale@graphiant.com>2021-10-04 12:48:40 +0000
commita0f3f8cb7c977b50d0c489cba0ffa963e2c891b3 (patch)
treef5be417a08220705d905f0520a24c8e04bb7778f /src/vnet
parent7c7b50546107d4e1a5b71a1f55dbf4e1d85126ad (diff)
fib: fix unitialized padding in fib_api_next_hop_decode
If the type is IPv4, makes sure the padding bytes are set to 0 as this is used by ip46_address_is_ip4() to detect the type. Type: fix Change-Id: I6a81fa05a6b227086853901bf3dcdc66e6d04d2c Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/fib/fib_api.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c
index 0254c551411..3ccb9cab5ae 100644
--- a/src/vnet/fib/fib_api.c
+++ b/src/vnet/fib/fib_api.c
@@ -65,10 +65,8 @@ static void
fib_api_next_hop_decode (const vl_api_fib_path_t *in,
ip46_address_t *out)
{
- if (in->proto == FIB_API_PATH_NH_PROTO_IP4)
- clib_memcpy (&out->ip4, &in->nh.address.ip4, sizeof (out->ip4));
- else if (in->proto == FIB_API_PATH_NH_PROTO_IP6)
- clib_memcpy (&out->ip6, &in->nh.address.ip6, sizeof (out->ip6));
+ ASSERT (FIB_API_PATH_NH_PROTO_IP4 == in->proto || FIB_API_PATH_NH_PROTO_IP6 == in->proto);
+ *out = to_ip46 (FIB_API_PATH_NH_PROTO_IP6 == in->proto, (void *)&in->nh.address);
}
static vl_api_fib_path_nh_proto_t