linux-cp: fix route prefix construction 42/40142/4
authorAlexander Skorichenko <askorichenko@netgate.com>
Tue, 26 Dec 2023 15:27:10 +0000 (16:27 +0100)
committerMatthew Smith <mgsmith@netgate.com>
Wed, 10 Jan 2024 16:16:35 +0000 (16:16 +0000)
Prevent comparison ops for uninitialized IPv6 prefix bytes.

Type: fix

Change-Id: I440fea7f0725769406ad348eb3402a98c593dc3c
Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
src/plugins/linux-cp/lcp_router.c

index f53ec4f..0efd53e 100644 (file)
@@ -1007,6 +1007,7 @@ lcp_router_route_mk_prefix (struct rtnl_route *r, fib_prefix_t *p)
   ip46_address_t *paddr = &p->fp_addr;
   u32 entry;
 
+  ip46_address_reset (paddr);
   p->fp_proto = lcp_router_proto_k2f (nl_addr_get_family (addr));
 
   switch (p->fp_proto)
@@ -1018,7 +1019,6 @@ lcp_router_route_mk_prefix (struct rtnl_route *r, fib_prefix_t *p)
       p->fp_eos = MPLS_NON_EOS;
       return;
     case FIB_PROTOCOL_IP4:
-      ip46_address_reset (paddr);
       memcpy (&paddr->ip4, baddr, blen);
       break;
     case FIB_PROTOCOL_IP6: