]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: avoid memcmp comparison of struct nexthop
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 8 Feb 2022 17:34:28 +0000 (20:34 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 8 Feb 2022 17:34:28 +0000 (20:34 +0300)
Using memcmp is wrong because struct nexthop may contain unitialized
padding bytes that should not be compared.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
bgpd/bgp_pbr.c

index c10007a593977243a4b6623e657fc636194a1f9f..f1befe73bf8e17b8761b68598d154a3600d077d4 100644 (file)
@@ -1314,10 +1314,7 @@ bool bgp_pbr_action_hash_equal(const void *arg1, const void *arg2)
        if (r1->afi != r2->afi)
                return false;
 
-       if (memcmp(&r1->nh, &r2->nh, sizeof(struct nexthop)))
-               return false;
-
-       return true;
+       return nexthop_same(&r1->nh, &r2->nh);
 }
 
 struct bgp_pbr_rule *bgp_pbr_rule_lookup(vrf_id_t vrf_id,