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>
(cherry picked from commit
e4190ca4abb5282a9b4144f8c629b8008c41f64b)
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,