mirror of
https://github.com/FRRouting/frr.git
synced 2025-05-01 05:57:15 +02:00
Merge branch 'pull/3197'
...with a nit fix Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
commit
064518517c
15
bfdd/bfd.c
15
bfdd/bfd.c
|
@ -861,15 +861,10 @@ static struct hash *bfd_vrf_hash;
|
||||||
static struct hash *bfd_iface_hash;
|
static struct hash *bfd_iface_hash;
|
||||||
|
|
||||||
static unsigned int bfd_id_hash_do(void *p);
|
static unsigned int bfd_id_hash_do(void *p);
|
||||||
static int bfd_id_hash_cmp(const void *n1, const void *n2);
|
|
||||||
static unsigned int bfd_shop_hash_do(void *p);
|
static unsigned int bfd_shop_hash_do(void *p);
|
||||||
static int bfd_shop_hash_cmp(const void *n1, const void *n2);
|
|
||||||
static unsigned int bfd_mhop_hash_do(void *p);
|
static unsigned int bfd_mhop_hash_do(void *p);
|
||||||
static int bfd_mhop_hash_cmp(const void *n1, const void *n2);
|
|
||||||
static unsigned int bfd_vrf_hash_do(void *p);
|
static unsigned int bfd_vrf_hash_do(void *p);
|
||||||
static int bfd_vrf_hash_cmp(const void *n1, const void *n2);
|
|
||||||
static unsigned int bfd_iface_hash_do(void *p);
|
static unsigned int bfd_iface_hash_do(void *p);
|
||||||
static int bfd_iface_hash_cmp(const void *n1, const void *n2);
|
|
||||||
|
|
||||||
static void _shop_key(struct bfd_session *bs, const struct bfd_shop_key *shop);
|
static void _shop_key(struct bfd_session *bs, const struct bfd_shop_key *shop);
|
||||||
static void _shop_key2(struct bfd_session *bs, const struct bfd_shop_key *shop);
|
static void _shop_key2(struct bfd_session *bs, const struct bfd_shop_key *shop);
|
||||||
|
@ -889,7 +884,7 @@ static unsigned int bfd_id_hash_do(void *p)
|
||||||
return jhash_1word(bs->discrs.my_discr, 0);
|
return jhash_1word(bs->discrs.my_discr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfd_id_hash_cmp(const void *n1, const void *n2)
|
static bool bfd_id_hash_cmp(const void *n1, const void *n2)
|
||||||
{
|
{
|
||||||
const struct bfd_session *bs1 = n1, *bs2 = n2;
|
const struct bfd_session *bs1 = n1, *bs2 = n2;
|
||||||
|
|
||||||
|
@ -904,7 +899,7 @@ static unsigned int bfd_shop_hash_do(void *p)
|
||||||
return jhash(&bs->shop, sizeof(bs->shop), 0);
|
return jhash(&bs->shop, sizeof(bs->shop), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfd_shop_hash_cmp(const void *n1, const void *n2)
|
static bool bfd_shop_hash_cmp(const void *n1, const void *n2)
|
||||||
{
|
{
|
||||||
const struct bfd_session *bs1 = n1, *bs2 = n2;
|
const struct bfd_session *bs1 = n1, *bs2 = n2;
|
||||||
|
|
||||||
|
@ -919,7 +914,7 @@ static unsigned int bfd_mhop_hash_do(void *p)
|
||||||
return jhash(&bs->mhop, sizeof(bs->mhop), 0);
|
return jhash(&bs->mhop, sizeof(bs->mhop), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfd_mhop_hash_cmp(const void *n1, const void *n2)
|
static bool bfd_mhop_hash_cmp(const void *n1, const void *n2)
|
||||||
{
|
{
|
||||||
const struct bfd_session *bs1 = n1, *bs2 = n2;
|
const struct bfd_session *bs1 = n1, *bs2 = n2;
|
||||||
|
|
||||||
|
@ -934,7 +929,7 @@ static unsigned int bfd_vrf_hash_do(void *p)
|
||||||
return jhash_1word(vrf->vrf_id, 0);
|
return jhash_1word(vrf->vrf_id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfd_vrf_hash_cmp(const void *n1, const void *n2)
|
static bool bfd_vrf_hash_cmp(const void *n1, const void *n2)
|
||||||
{
|
{
|
||||||
const struct bfd_vrf *v1 = n1, *v2 = n2;
|
const struct bfd_vrf *v1 = n1, *v2 = n2;
|
||||||
|
|
||||||
|
@ -949,7 +944,7 @@ static unsigned int bfd_iface_hash_do(void *p)
|
||||||
return string_hash_make(iface->ifname);
|
return string_hash_make(iface->ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfd_iface_hash_cmp(const void *n1, const void *n2)
|
static bool bfd_iface_hash_cmp(const void *n1, const void *n2)
|
||||||
{
|
{
|
||||||
const struct bfd_iface *i1 = n1, *i2 = n2;
|
const struct bfd_iface *i1 = n1, *i2 = n2;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ unsigned int baa_hash_key(void *p)
|
||||||
return attrhash_key_make(baa->attr);
|
return attrhash_key_make(baa->attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int baa_hash_cmp(const void *p1, const void *p2)
|
bool baa_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct bgp_advertise_attr *baa1 = p1;
|
const struct bgp_advertise_attr *baa1 = p1;
|
||||||
const struct bgp_advertise_attr *baa2 = p2;
|
const struct bgp_advertise_attr *baa2 = p2;
|
||||||
|
|
|
@ -177,7 +177,7 @@ extern void bgp_adj_in_remove(struct bgp_node *, struct bgp_adj_in *);
|
||||||
extern void bgp_sync_init(struct peer *);
|
extern void bgp_sync_init(struct peer *);
|
||||||
extern void bgp_sync_delete(struct peer *);
|
extern void bgp_sync_delete(struct peer *);
|
||||||
extern unsigned int baa_hash_key(void *p);
|
extern unsigned int baa_hash_key(void *p);
|
||||||
extern int baa_hash_cmp(const void *p1, const void *p2);
|
extern bool baa_hash_cmp(const void *p1, const void *p2);
|
||||||
extern void bgp_advertise_add(struct bgp_advertise_attr *baa,
|
extern void bgp_advertise_add(struct bgp_advertise_attr *baa,
|
||||||
struct bgp_advertise *adv);
|
struct bgp_advertise *adv);
|
||||||
extern struct bgp_advertise *bgp_advertise_new(void);
|
extern struct bgp_advertise *bgp_advertise_new(void);
|
||||||
|
|
|
@ -1726,23 +1726,23 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath,
|
||||||
/* Compare leftmost AS value for MED check. If as1's leftmost AS and
|
/* Compare leftmost AS value for MED check. If as1's leftmost AS and
|
||||||
as2's leftmost AS is same return 1. (confederation as-path
|
as2's leftmost AS is same return 1. (confederation as-path
|
||||||
only). */
|
only). */
|
||||||
int aspath_cmp_left_confed(const struct aspath *aspath1,
|
bool aspath_cmp_left_confed(const struct aspath *aspath1,
|
||||||
const struct aspath *aspath2)
|
const struct aspath *aspath2)
|
||||||
{
|
{
|
||||||
if (!(aspath1 && aspath2))
|
if (!(aspath1 && aspath2))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (!(aspath1->segments && aspath2->segments))
|
if (!(aspath1->segments && aspath2->segments))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((aspath1->segments->type != AS_CONFED_SEQUENCE)
|
if ((aspath1->segments->type != AS_CONFED_SEQUENCE)
|
||||||
|| (aspath2->segments->type != AS_CONFED_SEQUENCE))
|
|| (aspath2->segments->type != AS_CONFED_SEQUENCE))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (aspath1->segments->as[0] == aspath2->segments->as[0])
|
if (aspath1->segments->as[0] == aspath2->segments->as[0])
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete all AS_CONFED_SEQUENCE/SET segments from aspath.
|
/* Delete all AS_CONFED_SEQUENCE/SET segments from aspath.
|
||||||
|
@ -2008,7 +2008,7 @@ unsigned int aspath_key_make(void *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If two aspath have same value then return 1 else return 0 */
|
/* If two aspath have same value then return 1 else return 0 */
|
||||||
int aspath_cmp(const void *arg1, const void *arg2)
|
bool aspath_cmp(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct assegment *seg1 = ((const struct aspath *)arg1)->segments;
|
const struct assegment *seg1 = ((const struct aspath *)arg1)->segments;
|
||||||
const struct assegment *seg2 = ((const struct aspath *)arg2)->segments;
|
const struct assegment *seg2 = ((const struct aspath *)arg2)->segments;
|
||||||
|
@ -2016,18 +2016,18 @@ int aspath_cmp(const void *arg1, const void *arg2)
|
||||||
while (seg1 || seg2) {
|
while (seg1 || seg2) {
|
||||||
int i;
|
int i;
|
||||||
if ((!seg1 && seg2) || (seg1 && !seg2))
|
if ((!seg1 && seg2) || (seg1 && !seg2))
|
||||||
return 0;
|
return false;
|
||||||
if (seg1->type != seg2->type)
|
if (seg1->type != seg2->type)
|
||||||
return 0;
|
return false;
|
||||||
if (seg1->length != seg2->length)
|
if (seg1->length != seg2->length)
|
||||||
return 0;
|
return false;
|
||||||
for (i = 0; i < seg1->length; i++)
|
for (i = 0; i < seg1->length; i++)
|
||||||
if (seg1->as[i] != seg2->as[i])
|
if (seg1->as[i] != seg2->as[i])
|
||||||
return 0;
|
return false;
|
||||||
seg1 = seg1->next;
|
seg1 = seg1->next;
|
||||||
seg2 = seg2->next;
|
seg2 = seg2->next;
|
||||||
}
|
}
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AS path hash initialize. */
|
/* AS path hash initialize. */
|
||||||
|
|
|
@ -85,9 +85,10 @@ extern struct aspath *aspath_filter_exclude(struct aspath *, struct aspath *);
|
||||||
extern struct aspath *aspath_add_seq_n(struct aspath *, as_t, unsigned);
|
extern struct aspath *aspath_add_seq_n(struct aspath *, as_t, unsigned);
|
||||||
extern struct aspath *aspath_add_seq(struct aspath *, as_t);
|
extern struct aspath *aspath_add_seq(struct aspath *, as_t);
|
||||||
extern struct aspath *aspath_add_confed_seq(struct aspath *, as_t);
|
extern struct aspath *aspath_add_confed_seq(struct aspath *, as_t);
|
||||||
extern int aspath_cmp(const void *, const void *);
|
extern bool aspath_cmp(const void *as1, const void *as2);
|
||||||
extern int aspath_cmp_left(const struct aspath *, const struct aspath *);
|
extern int aspath_cmp_left(const struct aspath *, const struct aspath *);
|
||||||
extern int aspath_cmp_left_confed(const struct aspath *, const struct aspath *);
|
extern bool aspath_cmp_left_confed(const struct aspath *as1,
|
||||||
|
const struct aspath *as2xs);
|
||||||
extern struct aspath *aspath_delete_confed_seq(struct aspath *);
|
extern struct aspath *aspath_delete_confed_seq(struct aspath *);
|
||||||
extern struct aspath *aspath_empty(void);
|
extern struct aspath *aspath_empty(void);
|
||||||
extern struct aspath *aspath_empty_get(void);
|
extern struct aspath *aspath_empty_get(void);
|
||||||
|
|
|
@ -146,7 +146,7 @@ static unsigned int cluster_hash_key_make(void *p)
|
||||||
return jhash(cluster->list, cluster->length, 0);
|
return jhash(cluster->list, cluster->length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cluster_hash_cmp(const void *p1, const void *p2)
|
static bool cluster_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct cluster_list *cluster1 = p1;
|
const struct cluster_list *cluster1 = p1;
|
||||||
const struct cluster_list *cluster2 = p2;
|
const struct cluster_list *cluster2 = p2;
|
||||||
|
@ -355,7 +355,7 @@ static unsigned int encap_hash_key_make(void *p)
|
||||||
return jhash(encap->value, encap->length, 0);
|
return jhash(encap->value, encap->length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int encap_hash_cmp(const void *p1, const void *p2)
|
static bool encap_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
return encap_same((const struct bgp_attr_encap_subtlv *)p1,
|
return encap_same((const struct bgp_attr_encap_subtlv *)p1,
|
||||||
(const struct bgp_attr_encap_subtlv *)p2);
|
(const struct bgp_attr_encap_subtlv *)p2);
|
||||||
|
@ -441,7 +441,7 @@ static unsigned int transit_hash_key_make(void *p)
|
||||||
return jhash(transit->val, transit->length, 0);
|
return jhash(transit->val, transit->length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int transit_hash_cmp(const void *p1, const void *p2)
|
static bool transit_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct transit *transit1 = p1;
|
const struct transit *transit1 = p1;
|
||||||
const struct transit *transit2 = p2;
|
const struct transit *transit2 = p2;
|
||||||
|
@ -527,7 +527,7 @@ unsigned int attrhash_key_make(void *p)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int attrhash_cmp(const void *p1, const void *p2)
|
bool attrhash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct attr *attr1 = p1;
|
const struct attr *attr1 = p1;
|
||||||
const struct attr *attr2 = p2;
|
const struct attr *attr2 = p2;
|
||||||
|
@ -565,10 +565,10 @@ int attrhash_cmp(const void *p1, const void *p2)
|
||||||
&& overlay_index_same(attr1, attr2)
|
&& overlay_index_same(attr1, attr2)
|
||||||
&& attr1->nh_ifindex == attr2->nh_ifindex
|
&& attr1->nh_ifindex == attr2->nh_ifindex
|
||||||
&& attr1->nh_lla_ifindex == attr2->nh_lla_ifindex)
|
&& attr1->nh_lla_ifindex == attr2->nh_lla_ifindex)
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void attrhash_init(void)
|
static void attrhash_init(void)
|
||||||
|
|
|
@ -287,7 +287,7 @@ extern bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *,
|
||||||
mpls_label_t *, uint32_t, int, uint32_t);
|
mpls_label_t *, uint32_t, int, uint32_t);
|
||||||
extern void bgp_dump_routes_attr(struct stream *, struct attr *,
|
extern void bgp_dump_routes_attr(struct stream *, struct attr *,
|
||||||
struct prefix *);
|
struct prefix *);
|
||||||
extern int attrhash_cmp(const void *, const void *);
|
extern bool attrhash_cmp(const void *arg1, const void *arg2);
|
||||||
extern unsigned int attrhash_key_make(void *);
|
extern unsigned int attrhash_key_make(void *);
|
||||||
extern void attr_show_all(struct vty *);
|
extern void attr_show_all(struct vty *);
|
||||||
extern unsigned long int attr_count(void);
|
extern unsigned long int attr_count(void);
|
||||||
|
|
|
@ -614,17 +614,17 @@ int community_match(const struct community *com1, const struct community *com2)
|
||||||
|
|
||||||
/* If two aspath have same value then return 1 else return 0. This
|
/* If two aspath have same value then return 1 else return 0. This
|
||||||
function is used by hash package. */
|
function is used by hash package. */
|
||||||
int community_cmp(const struct community *com1, const struct community *com2)
|
bool community_cmp(const struct community *com1, const struct community *com2)
|
||||||
{
|
{
|
||||||
if (com1 == NULL && com2 == NULL)
|
if (com1 == NULL && com2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
if (com1 == NULL || com2 == NULL)
|
if (com1 == NULL || com2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (com1->size == com2->size)
|
if (com1->size == com2->size)
|
||||||
if (memcmp(com1->val, com2->val, com1->size * 4) == 0)
|
if (memcmp(com1->val, com2->val, com1->size * 4) == 0)
|
||||||
return 1;
|
return true;
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add com2 to the end of com1. */
|
/* Add com2 to the end of com1. */
|
||||||
|
@ -902,7 +902,7 @@ void community_init(void)
|
||||||
{
|
{
|
||||||
comhash =
|
comhash =
|
||||||
hash_create((unsigned int (*)(void *))community_hash_make,
|
hash_create((unsigned int (*)(void *))community_hash_make,
|
||||||
(int (*)(const void *, const void *))community_cmp,
|
(bool (*)(const void *, const void *))community_cmp,
|
||||||
"BGP Community Hash");
|
"BGP Community Hash");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,8 @@ extern char *community_str(struct community *, bool make_json);
|
||||||
extern unsigned int community_hash_make(struct community *);
|
extern unsigned int community_hash_make(struct community *);
|
||||||
extern struct community *community_str2com(const char *);
|
extern struct community *community_str2com(const char *);
|
||||||
extern int community_match(const struct community *, const struct community *);
|
extern int community_match(const struct community *, const struct community *);
|
||||||
extern int community_cmp(const struct community *, const struct community *);
|
extern bool community_cmp(const struct community *c1,
|
||||||
|
const struct community *c2);
|
||||||
extern struct community *community_merge(struct community *,
|
extern struct community *community_merge(struct community *,
|
||||||
struct community *);
|
struct community *);
|
||||||
extern struct community *community_delete(struct community *,
|
extern struct community *community_delete(struct community *,
|
||||||
|
|
|
@ -253,16 +253,16 @@ unsigned int ecommunity_hash_make(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare two Extended Communities Attribute structure. */
|
/* Compare two Extended Communities Attribute structure. */
|
||||||
int ecommunity_cmp(const void *arg1, const void *arg2)
|
bool ecommunity_cmp(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct ecommunity *ecom1 = arg1;
|
const struct ecommunity *ecom1 = arg1;
|
||||||
const struct ecommunity *ecom2 = arg2;
|
const struct ecommunity *ecom2 = arg2;
|
||||||
|
|
||||||
if (ecom1 == NULL && ecom2 == NULL)
|
if (ecom1 == NULL && ecom2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (ecom1 == NULL || ecom2 == NULL)
|
if (ecom1 == NULL || ecom2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return (ecom1->size == ecom2->size
|
return (ecom1->size == ecom2->size
|
||||||
&& memcmp(ecom1->val, ecom2->val, ecom1->size * ECOMMUNITY_SIZE)
|
&& memcmp(ecom1->val, ecom2->val, ecom1->size * ECOMMUNITY_SIZE)
|
||||||
|
|
|
@ -154,7 +154,7 @@ extern struct ecommunity *ecommunity_merge(struct ecommunity *,
|
||||||
struct ecommunity *);
|
struct ecommunity *);
|
||||||
extern struct ecommunity *ecommunity_uniq_sort(struct ecommunity *);
|
extern struct ecommunity *ecommunity_uniq_sort(struct ecommunity *);
|
||||||
extern struct ecommunity *ecommunity_intern(struct ecommunity *);
|
extern struct ecommunity *ecommunity_intern(struct ecommunity *);
|
||||||
extern int ecommunity_cmp(const void *, const void *);
|
extern bool ecommunity_cmp(const void *arg1, const void *arg2);
|
||||||
extern void ecommunity_unintern(struct ecommunity **);
|
extern void ecommunity_unintern(struct ecommunity **);
|
||||||
extern unsigned int ecommunity_hash_make(void *);
|
extern unsigned int ecommunity_hash_make(void *);
|
||||||
extern struct ecommunity *ecommunity_str2com(const char *, int, int);
|
extern struct ecommunity *ecommunity_str2com(const char *, int, int);
|
||||||
|
|
|
@ -92,16 +92,16 @@ static unsigned int esi_hash_keymake(void *p)
|
||||||
/*
|
/*
|
||||||
* Compare two ESIs.
|
* Compare two ESIs.
|
||||||
*/
|
*/
|
||||||
static int esi_cmp(const void *p1, const void *p2)
|
static bool esi_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct evpnes *pes1 = p1;
|
const struct evpnes *pes1 = p1;
|
||||||
const struct evpnes *pes2 = p2;
|
const struct evpnes *pes2 = p2;
|
||||||
|
|
||||||
if (pes1 == NULL && pes2 == NULL)
|
if (pes1 == NULL && pes2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (pes1 == NULL || pes2 == NULL)
|
if (pes1 == NULL || pes2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return (memcmp(pes1->esi.val, pes2->esi.val, ESI_BYTES) == 0);
|
return (memcmp(pes1->esi.val, pes2->esi.val, ESI_BYTES) == 0);
|
||||||
}
|
}
|
||||||
|
@ -118,15 +118,15 @@ static unsigned int vni_hash_key_make(void *p)
|
||||||
/*
|
/*
|
||||||
* Comparison function for vni hash
|
* Comparison function for vni hash
|
||||||
*/
|
*/
|
||||||
static int vni_hash_cmp(const void *p1, const void *p2)
|
static bool vni_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct bgpevpn *vpn1 = p1;
|
const struct bgpevpn *vpn1 = p1;
|
||||||
const struct bgpevpn *vpn2 = p2;
|
const struct bgpevpn *vpn2 = p2;
|
||||||
|
|
||||||
if (!vpn1 && !vpn2)
|
if (!vpn1 && !vpn2)
|
||||||
return 1;
|
return true;
|
||||||
if (!vpn1 || !vpn2)
|
if (!vpn1 || !vpn2)
|
||||||
return 0;
|
return false;
|
||||||
return (vpn1->vni == vpn2->vni);
|
return (vpn1->vni == vpn2->vni);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,16 +152,16 @@ static unsigned int vrf_import_rt_hash_key_make(void *p)
|
||||||
/*
|
/*
|
||||||
* Comparison function for vrf import rt hash
|
* Comparison function for vrf import rt hash
|
||||||
*/
|
*/
|
||||||
static int vrf_import_rt_hash_cmp(const void *p1, const void *p2)
|
static bool vrf_import_rt_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct vrf_irt_node *irt1 = p1;
|
const struct vrf_irt_node *irt1 = p1;
|
||||||
const struct vrf_irt_node *irt2 = p2;
|
const struct vrf_irt_node *irt2 = p2;
|
||||||
|
|
||||||
if (irt1 == NULL && irt2 == NULL)
|
if (irt1 == NULL && irt2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (irt1 == NULL || irt2 == NULL)
|
if (irt1 == NULL || irt2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return (memcmp(irt1->rt.val, irt2->rt.val, ECOMMUNITY_SIZE) == 0);
|
return (memcmp(irt1->rt.val, irt2->rt.val, ECOMMUNITY_SIZE) == 0);
|
||||||
}
|
}
|
||||||
|
@ -269,16 +269,16 @@ static unsigned int import_rt_hash_key_make(void *p)
|
||||||
/*
|
/*
|
||||||
* Comparison function for import rt hash
|
* Comparison function for import rt hash
|
||||||
*/
|
*/
|
||||||
static int import_rt_hash_cmp(const void *p1, const void *p2)
|
static bool import_rt_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct irt_node *irt1 = p1;
|
const struct irt_node *irt1 = p1;
|
||||||
const struct irt_node *irt2 = p2;
|
const struct irt_node *irt2 = p2;
|
||||||
|
|
||||||
if (irt1 == NULL && irt2 == NULL)
|
if (irt1 == NULL && irt2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (irt1 == NULL || irt2 == NULL)
|
if (irt1 == NULL || irt2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return (memcmp(irt1->rt.val, irt2->rt.val, ECOMMUNITY_SIZE) == 0);
|
return (memcmp(irt1->rt.val, irt2->rt.val, ECOMMUNITY_SIZE) == 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,10 +123,11 @@ static void peer_process(struct hash_backet *hb, void *arg)
|
||||||
*next_update = diff;
|
*next_update = diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int peer_hash_cmp(const void *f, const void *s)
|
static bool peer_hash_cmp(const void *f, const void *s)
|
||||||
{
|
{
|
||||||
const struct pkat *p1 = f;
|
const struct pkat *p1 = f;
|
||||||
const struct pkat *p2 = s;
|
const struct pkat *p2 = s;
|
||||||
|
|
||||||
return p1->peer == p2->peer;
|
return p1->peer == p2->peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ unsigned int lcommunity_hash_make(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare two Large Communities Attribute structure. */
|
/* Compare two Large Communities Attribute structure. */
|
||||||
int lcommunity_cmp(const void *arg1, const void *arg2)
|
bool lcommunity_cmp(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct lcommunity *lcom1 = arg1;
|
const struct lcommunity *lcom1 = arg1;
|
||||||
const struct lcommunity *lcom2 = arg2;
|
const struct lcommunity *lcom2 = arg2;
|
||||||
|
|
|
@ -60,7 +60,7 @@ extern struct lcommunity *lcommunity_merge(struct lcommunity *,
|
||||||
struct lcommunity *);
|
struct lcommunity *);
|
||||||
extern struct lcommunity *lcommunity_uniq_sort(struct lcommunity *);
|
extern struct lcommunity *lcommunity_uniq_sort(struct lcommunity *);
|
||||||
extern struct lcommunity *lcommunity_intern(struct lcommunity *);
|
extern struct lcommunity *lcommunity_intern(struct lcommunity *);
|
||||||
extern int lcommunity_cmp(const void *, const void *);
|
extern bool lcommunity_cmp(const void *arg1, const void *arg2);
|
||||||
extern void lcommunity_unintern(struct lcommunity **);
|
extern void lcommunity_unintern(struct lcommunity **);
|
||||||
extern unsigned int lcommunity_hash_make(void *);
|
extern unsigned int lcommunity_hash_make(void *);
|
||||||
extern struct hash *lcommunity_hash(void);
|
extern struct hash *lcommunity_hash(void);
|
||||||
|
|
|
@ -123,7 +123,7 @@ static unsigned int bgp_tip_hash_key_make(void *p)
|
||||||
return jhash_1word(addr->addr.s_addr, 0);
|
return jhash_1word(addr->addr.s_addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bgp_tip_hash_cmp(const void *p1, const void *p2)
|
static bool bgp_tip_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct tip_addr *addr1 = p1;
|
const struct tip_addr *addr1 = p1;
|
||||||
const struct tip_addr *addr2 = p2;
|
const struct tip_addr *addr2 = p2;
|
||||||
|
@ -246,7 +246,7 @@ static unsigned int bgp_address_hash_key_make(void *p)
|
||||||
return jhash_1word(addr->addr.s_addr, 0);
|
return jhash_1word(addr->addr.s_addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bgp_address_hash_cmp(const void *p1, const void *p2)
|
static bool bgp_address_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct bgp_addr *addr1 = p1;
|
const struct bgp_addr *addr1 = p1;
|
||||||
const struct bgp_addr *addr2 = p2;
|
const struct bgp_addr *addr2 = p2;
|
||||||
|
|
|
@ -847,7 +847,7 @@ uint32_t bgp_pbr_match_hash_key(void *arg)
|
||||||
return jhash_1word(pbm->type, key);
|
return jhash_1word(pbm->type, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bgp_pbr_match_hash_equal(const void *arg1, const void *arg2)
|
bool bgp_pbr_match_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct bgp_pbr_match *r1, *r2;
|
const struct bgp_pbr_match *r1, *r2;
|
||||||
|
|
||||||
|
@ -855,35 +855,35 @@ int bgp_pbr_match_hash_equal(const void *arg1, const void *arg2)
|
||||||
r2 = (const struct bgp_pbr_match *)arg2;
|
r2 = (const struct bgp_pbr_match *)arg2;
|
||||||
|
|
||||||
if (r1->vrf_id != r2->vrf_id)
|
if (r1->vrf_id != r2->vrf_id)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->type != r2->type)
|
if (r1->type != r2->type)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->flags != r2->flags)
|
if (r1->flags != r2->flags)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->action != r2->action)
|
if (r1->action != r2->action)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->pkt_len_min != r2->pkt_len_min)
|
if (r1->pkt_len_min != r2->pkt_len_min)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->pkt_len_max != r2->pkt_len_max)
|
if (r1->pkt_len_max != r2->pkt_len_max)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->tcp_flags != r2->tcp_flags)
|
if (r1->tcp_flags != r2->tcp_flags)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->tcp_mask_flags != r2->tcp_mask_flags)
|
if (r1->tcp_mask_flags != r2->tcp_mask_flags)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->dscp_value != r2->dscp_value)
|
if (r1->dscp_value != r2->dscp_value)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->fragment != r2->fragment)
|
if (r1->fragment != r2->fragment)
|
||||||
return 0;
|
return false;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t bgp_pbr_match_entry_hash_key(void *arg)
|
uint32_t bgp_pbr_match_entry_hash_key(void *arg)
|
||||||
|
@ -903,45 +903,41 @@ uint32_t bgp_pbr_match_entry_hash_key(void *arg)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bgp_pbr_match_entry_hash_equal(const void *arg1, const void *arg2)
|
bool bgp_pbr_match_entry_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct bgp_pbr_match_entry *r1, *r2;
|
const struct bgp_pbr_match_entry *r1, *r2;
|
||||||
|
|
||||||
r1 = (const struct bgp_pbr_match_entry *)arg1;
|
r1 = (const struct bgp_pbr_match_entry *)arg1;
|
||||||
r2 = (const struct bgp_pbr_match_entry *)arg2;
|
r2 = (const struct bgp_pbr_match_entry *)arg2;
|
||||||
|
|
||||||
/* on updates, comparing
|
/*
|
||||||
* backpointer is not necessary
|
* on updates, comparing backpointer is not necessary
|
||||||
*/
|
* unique value is self calculated
|
||||||
|
* rate is ignored for now
|
||||||
/* unique value is self calculated
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* rate is ignored for now
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!prefix_same(&r1->src, &r2->src))
|
if (!prefix_same(&r1->src, &r2->src))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (!prefix_same(&r1->dst, &r2->dst))
|
if (!prefix_same(&r1->dst, &r2->dst))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->src_port_min != r2->src_port_min)
|
if (r1->src_port_min != r2->src_port_min)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->dst_port_min != r2->dst_port_min)
|
if (r1->dst_port_min != r2->dst_port_min)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->src_port_max != r2->src_port_max)
|
if (r1->src_port_max != r2->src_port_max)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->dst_port_max != r2->dst_port_max)
|
if (r1->dst_port_max != r2->dst_port_max)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->proto != r2->proto)
|
if (r1->proto != r2->proto)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t bgp_pbr_action_hash_key(void *arg)
|
uint32_t bgp_pbr_action_hash_key(void *arg)
|
||||||
|
@ -955,7 +951,7 @@ uint32_t bgp_pbr_action_hash_key(void *arg)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bgp_pbr_action_hash_equal(const void *arg1, const void *arg2)
|
bool bgp_pbr_action_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct bgp_pbr_action *r1, *r2;
|
const struct bgp_pbr_action *r1, *r2;
|
||||||
|
|
||||||
|
@ -967,11 +963,12 @@ int bgp_pbr_action_hash_equal(const void *arg1, const void *arg2)
|
||||||
* rate is ignored
|
* rate is ignored
|
||||||
*/
|
*/
|
||||||
if (r1->vrf_id != r2->vrf_id)
|
if (r1->vrf_id != r2->vrf_id)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (memcmp(&r1->nh, &r2->nh, sizeof(struct nexthop)))
|
if (memcmp(&r1->nh, &r2->nh, sizeof(struct nexthop)))
|
||||||
return 0;
|
return false;
|
||||||
return 1;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bgp_pbr_action *bgp_pbr_action_rule_lookup(vrf_id_t vrf_id,
|
struct bgp_pbr_action *bgp_pbr_action_rule_lookup(vrf_id_t vrf_id,
|
||||||
|
|
|
@ -267,13 +267,13 @@ extern void bgp_pbr_cleanup(struct bgp *bgp);
|
||||||
extern void bgp_pbr_init(struct bgp *bgp);
|
extern void bgp_pbr_init(struct bgp *bgp);
|
||||||
|
|
||||||
extern uint32_t bgp_pbr_action_hash_key(void *arg);
|
extern uint32_t bgp_pbr_action_hash_key(void *arg);
|
||||||
extern int bgp_pbr_action_hash_equal(const void *arg1,
|
extern bool bgp_pbr_action_hash_equal(const void *arg1,
|
||||||
const void *arg2);
|
const void *arg2);
|
||||||
extern uint32_t bgp_pbr_match_entry_hash_key(void *arg);
|
extern uint32_t bgp_pbr_match_entry_hash_key(void *arg);
|
||||||
extern int bgp_pbr_match_entry_hash_equal(const void *arg1,
|
extern bool bgp_pbr_match_entry_hash_equal(const void *arg1,
|
||||||
const void *arg2);
|
const void *arg2);
|
||||||
extern uint32_t bgp_pbr_match_hash_key(void *arg);
|
extern uint32_t bgp_pbr_match_hash_key(void *arg);
|
||||||
extern int bgp_pbr_match_hash_equal(const void *arg1,
|
extern bool bgp_pbr_match_hash_equal(const void *arg1,
|
||||||
const void *arg2);
|
const void *arg2);
|
||||||
|
|
||||||
void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api);
|
void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api);
|
||||||
|
|
|
@ -393,7 +393,7 @@ static unsigned int updgrp_hash_key_make(void *p)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int updgrp_hash_cmp(const void *p1, const void *p2)
|
static bool updgrp_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct update_group *grp1;
|
const struct update_group *grp1;
|
||||||
const struct update_group *grp2;
|
const struct update_group *grp2;
|
||||||
|
@ -407,7 +407,7 @@ static int updgrp_hash_cmp(const void *p1, const void *p2)
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
|
|
||||||
if (!p1 || !p2)
|
if (!p1 || !p2)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
grp1 = p1;
|
grp1 = p1;
|
||||||
grp2 = p2;
|
grp2 = p2;
|
||||||
|
@ -422,68 +422,68 @@ static int updgrp_hash_cmp(const void *p1, const void *p2)
|
||||||
|
|
||||||
/* put EBGP and IBGP peers in different update groups */
|
/* put EBGP and IBGP peers in different update groups */
|
||||||
if (pe1->sort != pe2->sort)
|
if (pe1->sort != pe2->sort)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
/* check peer flags */
|
/* check peer flags */
|
||||||
if ((pe1->flags & PEER_UPDGRP_FLAGS)
|
if ((pe1->flags & PEER_UPDGRP_FLAGS)
|
||||||
!= (pe2->flags & PEER_UPDGRP_FLAGS))
|
!= (pe2->flags & PEER_UPDGRP_FLAGS))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
/* If there is 'local-as' configured, it should match. */
|
/* If there is 'local-as' configured, it should match. */
|
||||||
if (pe1->change_local_as != pe2->change_local_as)
|
if (pe1->change_local_as != pe2->change_local_as)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
/* flags like route reflector client */
|
/* flags like route reflector client */
|
||||||
if ((flags1 & PEER_UPDGRP_AF_FLAGS) != (flags2 & PEER_UPDGRP_AF_FLAGS))
|
if ((flags1 & PEER_UPDGRP_AF_FLAGS) != (flags2 & PEER_UPDGRP_AF_FLAGS))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((pe1->cap & PEER_UPDGRP_CAP_FLAGS)
|
if ((pe1->cap & PEER_UPDGRP_CAP_FLAGS)
|
||||||
!= (pe2->cap & PEER_UPDGRP_CAP_FLAGS))
|
!= (pe2->cap & PEER_UPDGRP_CAP_FLAGS))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((pe1->af_cap[afi][safi] & PEER_UPDGRP_AF_CAP_FLAGS)
|
if ((pe1->af_cap[afi][safi] & PEER_UPDGRP_AF_CAP_FLAGS)
|
||||||
!= (pe2->af_cap[afi][safi] & PEER_UPDGRP_AF_CAP_FLAGS))
|
!= (pe2->af_cap[afi][safi] & PEER_UPDGRP_AF_CAP_FLAGS))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (pe1->v_routeadv != pe2->v_routeadv)
|
if (pe1->v_routeadv != pe2->v_routeadv)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (pe1->group != pe2->group)
|
if (pe1->group != pe2->group)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
/* route-map names should be the same */
|
/* route-map names should be the same */
|
||||||
if ((fl1->map[RMAP_OUT].name && !fl2->map[RMAP_OUT].name)
|
if ((fl1->map[RMAP_OUT].name && !fl2->map[RMAP_OUT].name)
|
||||||
|| (!fl1->map[RMAP_OUT].name && fl2->map[RMAP_OUT].name)
|
|| (!fl1->map[RMAP_OUT].name && fl2->map[RMAP_OUT].name)
|
||||||
|| (fl1->map[RMAP_OUT].name && fl2->map[RMAP_OUT].name
|
|| (fl1->map[RMAP_OUT].name && fl2->map[RMAP_OUT].name
|
||||||
&& strcmp(fl1->map[RMAP_OUT].name, fl2->map[RMAP_OUT].name)))
|
&& strcmp(fl1->map[RMAP_OUT].name, fl2->map[RMAP_OUT].name)))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((fl1->dlist[FILTER_OUT].name && !fl2->dlist[FILTER_OUT].name)
|
if ((fl1->dlist[FILTER_OUT].name && !fl2->dlist[FILTER_OUT].name)
|
||||||
|| (!fl1->dlist[FILTER_OUT].name && fl2->dlist[FILTER_OUT].name)
|
|| (!fl1->dlist[FILTER_OUT].name && fl2->dlist[FILTER_OUT].name)
|
||||||
|| (fl1->dlist[FILTER_OUT].name && fl2->dlist[FILTER_OUT].name
|
|| (fl1->dlist[FILTER_OUT].name && fl2->dlist[FILTER_OUT].name
|
||||||
&& strcmp(fl1->dlist[FILTER_OUT].name,
|
&& strcmp(fl1->dlist[FILTER_OUT].name,
|
||||||
fl2->dlist[FILTER_OUT].name)))
|
fl2->dlist[FILTER_OUT].name)))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((fl1->plist[FILTER_OUT].name && !fl2->plist[FILTER_OUT].name)
|
if ((fl1->plist[FILTER_OUT].name && !fl2->plist[FILTER_OUT].name)
|
||||||
|| (!fl1->plist[FILTER_OUT].name && fl2->plist[FILTER_OUT].name)
|
|| (!fl1->plist[FILTER_OUT].name && fl2->plist[FILTER_OUT].name)
|
||||||
|| (fl1->plist[FILTER_OUT].name && fl2->plist[FILTER_OUT].name
|
|| (fl1->plist[FILTER_OUT].name && fl2->plist[FILTER_OUT].name
|
||||||
&& strcmp(fl1->plist[FILTER_OUT].name,
|
&& strcmp(fl1->plist[FILTER_OUT].name,
|
||||||
fl2->plist[FILTER_OUT].name)))
|
fl2->plist[FILTER_OUT].name)))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((fl1->aslist[FILTER_OUT].name && !fl2->aslist[FILTER_OUT].name)
|
if ((fl1->aslist[FILTER_OUT].name && !fl2->aslist[FILTER_OUT].name)
|
||||||
|| (!fl1->aslist[FILTER_OUT].name && fl2->aslist[FILTER_OUT].name)
|
|| (!fl1->aslist[FILTER_OUT].name && fl2->aslist[FILTER_OUT].name)
|
||||||
|| (fl1->aslist[FILTER_OUT].name && fl2->aslist[FILTER_OUT].name
|
|| (fl1->aslist[FILTER_OUT].name && fl2->aslist[FILTER_OUT].name
|
||||||
&& strcmp(fl1->aslist[FILTER_OUT].name,
|
&& strcmp(fl1->aslist[FILTER_OUT].name,
|
||||||
fl2->aslist[FILTER_OUT].name)))
|
fl2->aslist[FILTER_OUT].name)))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((fl1->usmap.name && !fl2->usmap.name)
|
if ((fl1->usmap.name && !fl2->usmap.name)
|
||||||
|| (!fl1->usmap.name && fl2->usmap.name)
|
|| (!fl1->usmap.name && fl2->usmap.name)
|
||||||
|| (fl1->usmap.name && fl2->usmap.name
|
|| (fl1->usmap.name && fl2->usmap.name
|
||||||
&& strcmp(fl1->usmap.name, fl2->usmap.name)))
|
&& strcmp(fl1->usmap.name, fl2->usmap.name)))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((pe1->default_rmap[afi][safi].name
|
if ((pe1->default_rmap[afi][safi].name
|
||||||
&& !pe2->default_rmap[afi][safi].name)
|
&& !pe2->default_rmap[afi][safi].name)
|
||||||
|
@ -493,19 +493,19 @@ static int updgrp_hash_cmp(const void *p1, const void *p2)
|
||||||
&& pe2->default_rmap[afi][safi].name
|
&& pe2->default_rmap[afi][safi].name
|
||||||
&& strcmp(pe1->default_rmap[afi][safi].name,
|
&& strcmp(pe1->default_rmap[afi][safi].name,
|
||||||
pe2->default_rmap[afi][safi].name)))
|
pe2->default_rmap[afi][safi].name)))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((afi == AFI_IP6) && (pe1->shared_network != pe2->shared_network))
|
if ((afi == AFI_IP6) && (pe1->shared_network != pe2->shared_network))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if ((CHECK_FLAG(pe1->flags, PEER_FLAG_LONESOUL)
|
if ((CHECK_FLAG(pe1->flags, PEER_FLAG_LONESOUL)
|
||||||
|| CHECK_FLAG(pe1->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
|
|| CHECK_FLAG(pe1->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
|
||||||
|| CHECK_FLAG(pe1->af_cap[afi][safi],
|
|| CHECK_FLAG(pe1->af_cap[afi][safi],
|
||||||
PEER_CAP_ORF_PREFIX_SM_OLD_RCV))
|
PEER_CAP_ORF_PREFIX_SM_OLD_RCV))
|
||||||
&& !sockunion_same(&pe1->su, &pe2->su))
|
&& !sockunion_same(&pe1->su, &pe2->su))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void peer_lonesoul_or_not(struct peer *peer, int set)
|
static void peer_lonesoul_or_not(struct peer *peer, int set)
|
||||||
|
|
|
@ -769,7 +769,7 @@ static unsigned int peer_hash_key_make(void *p)
|
||||||
return sockunion_hash(&peer->su);
|
return sockunion_hash(&peer->su);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int peer_hash_same(const void *p1, const void *p2)
|
static bool peer_hash_same(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct peer *peer1 = p1;
|
const struct peer *peer1 = p1;
|
||||||
const struct peer *peer2 = p2;
|
const struct peer *peer2 = p2;
|
||||||
|
|
|
@ -105,7 +105,7 @@ static unsigned neighbor_entry_hash_key(void *np)
|
||||||
return jhash(n->vertex->N.id, ISIS_SYS_ID_LEN, 0x55aa5a5a);
|
return jhash(n->vertex->N.id, ISIS_SYS_ID_LEN, 0x55aa5a5a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int neighbor_entry_hash_cmp(const void *a, const void *b)
|
static bool neighbor_entry_hash_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct neighbor_entry *na = a, *nb = b;
|
const struct neighbor_entry *na = a, *nb = b;
|
||||||
|
|
||||||
|
|
|
@ -95,16 +95,16 @@ static unsigned isis_vertex_queue_hash_key(void *vp)
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((__unused__))
|
__attribute__((__unused__))
|
||||||
static int isis_vertex_queue_hash_cmp(const void *a, const void *b)
|
static bool isis_vertex_queue_hash_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct isis_vertex *va = a, *vb = b;
|
const struct isis_vertex *va = a, *vb = b;
|
||||||
|
|
||||||
if (va->type != vb->type)
|
if (va->type != vb->type)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (VTYPE_IP(va->type)) {
|
if (VTYPE_IP(va->type)) {
|
||||||
if (prefix_cmp(&va->N.ip.dest, &vb->N.ip.dest))
|
if (prefix_cmp(&va->N.ip.dest, &vb->N.ip.dest))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return prefix_cmp((const struct prefix *)&va->N.ip.src,
|
return prefix_cmp((const struct prefix *)&va->N.ip.src,
|
||||||
(const struct prefix *)&vb->N.ip.src) == 0;
|
(const struct prefix *)&vb->N.ip.src) == 0;
|
||||||
|
|
|
@ -58,18 +58,18 @@ static unsigned tx_queue_hash_key(void *p)
|
||||||
return jhash_1word(e->lsp->level, id_key);
|
return jhash_1word(e->lsp->level, id_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tx_queue_hash_cmp(const void *a, const void *b)
|
static bool tx_queue_hash_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct isis_tx_queue_entry *ea = a, *eb = b;
|
const struct isis_tx_queue_entry *ea = a, *eb = b;
|
||||||
|
|
||||||
if (ea->lsp->level != eb->lsp->level)
|
if (ea->lsp->level != eb->lsp->level)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (memcmp(ea->lsp->hdr.lsp_id, eb->lsp->hdr.lsp_id,
|
if (memcmp(ea->lsp->hdr.lsp_id, eb->lsp->hdr.lsp_id,
|
||||||
ISIS_SYS_ID_LEN + 2))
|
ISIS_SYS_ID_LEN + 2))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct isis_tx_queue *isis_tx_queue_new(void *arg,
|
struct isis_tx_queue *isis_tx_queue_new(void *arg,
|
||||||
|
|
|
@ -337,7 +337,7 @@ static unsigned int cmd_hash_key(void *p)
|
||||||
return jhash(p, size, 0);
|
return jhash(p, size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_hash_cmp(const void *a, const void *b)
|
static bool cmd_hash_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,15 +140,15 @@ static unsigned int distribute_hash_make(void *arg)
|
||||||
|
|
||||||
/* If two distribute-list have same value then return 1 else return
|
/* If two distribute-list have same value then return 1 else return
|
||||||
0. This function is used by hash package. */
|
0. This function is used by hash package. */
|
||||||
static int distribute_cmp(const struct distribute *dist1,
|
static bool distribute_cmp(const struct distribute *dist1,
|
||||||
const struct distribute *dist2)
|
const struct distribute *dist2)
|
||||||
{
|
{
|
||||||
if (dist1->ifname && dist2->ifname)
|
if (dist1->ifname && dist2->ifname)
|
||||||
if (strcmp(dist1->ifname, dist2->ifname) == 0)
|
if (strcmp(dist1->ifname, dist2->ifname) == 0)
|
||||||
return 1;
|
return true;
|
||||||
if (!dist1->ifname && !dist2->ifname)
|
if (!dist1->ifname && !dist2->ifname)
|
||||||
return 1;
|
return true;
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set access-list name to the distribute list. */
|
/* Set access-list name to the distribute list. */
|
||||||
|
@ -521,7 +521,7 @@ void distribute_list_init(int node)
|
||||||
{
|
{
|
||||||
disthash = hash_create(
|
disthash = hash_create(
|
||||||
distribute_hash_make,
|
distribute_hash_make,
|
||||||
(int (*)(const void *, const void *))distribute_cmp, NULL);
|
(bool (*)(const void *, const void *))distribute_cmp, NULL);
|
||||||
|
|
||||||
/* vtysh command-extraction doesn't grok install_element(node, ) */
|
/* vtysh command-extraction doesn't grok install_element(node, ) */
|
||||||
if (node == RIP_NODE) {
|
if (node == RIP_NODE) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ static void err_key_fini(void)
|
||||||
pthread_mutex_t refs_mtx = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t refs_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||||
struct hash *refs;
|
struct hash *refs;
|
||||||
|
|
||||||
static int ferr_hash_cmp(const void *a, const void *b)
|
static bool ferr_hash_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct log_ref *f_a = a;
|
const struct log_ref *f_a = a;
|
||||||
const struct log_ref *f_b = b;
|
const struct log_ref *f_b = b;
|
||||||
|
|
|
@ -38,7 +38,7 @@ static struct list *_hashes;
|
||||||
|
|
||||||
struct hash *hash_create_size(unsigned int size,
|
struct hash *hash_create_size(unsigned int size,
|
||||||
unsigned int (*hash_key)(void *),
|
unsigned int (*hash_key)(void *),
|
||||||
int (*hash_cmp)(const void *, const void *),
|
bool (*hash_cmp)(const void *, const void *),
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct hash *hash;
|
struct hash *hash;
|
||||||
|
@ -67,7 +67,7 @@ struct hash *hash_create_size(unsigned int size,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct hash *hash_create(unsigned int (*hash_key)(void *),
|
struct hash *hash_create(unsigned int (*hash_key)(void *),
|
||||||
int (*hash_cmp)(const void *, const void *),
|
bool (*hash_cmp)(const void *, const void *),
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
return hash_create_size(HASH_INITIAL_SIZE, hash_key, hash_cmp, name);
|
return hash_create_size(HASH_INITIAL_SIZE, hash_key, hash_cmp, name);
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct hash {
|
||||||
unsigned int (*hash_key)(void *);
|
unsigned int (*hash_key)(void *);
|
||||||
|
|
||||||
/* Data compare function. */
|
/* Data compare function. */
|
||||||
int (*hash_cmp)(const void *, const void *);
|
bool (*hash_cmp)(const void *, const void *);
|
||||||
|
|
||||||
/* Backet alloc. */
|
/* Backet alloc. */
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
|
@ -115,7 +115,7 @@ struct hash {
|
||||||
* a new hash table
|
* a new hash table
|
||||||
*/
|
*/
|
||||||
extern struct hash *hash_create(unsigned int (*hash_key)(void *),
|
extern struct hash *hash_create(unsigned int (*hash_key)(void *),
|
||||||
int (*hash_cmp)(const void *, const void *),
|
bool (*hash_cmp)(const void *, const void *),
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -150,7 +150,8 @@ extern struct hash *hash_create(unsigned int (*hash_key)(void *),
|
||||||
*/
|
*/
|
||||||
extern struct hash *
|
extern struct hash *
|
||||||
hash_create_size(unsigned int size, unsigned int (*hash_key)(void *),
|
hash_create_size(unsigned int size, unsigned int (*hash_key)(void *),
|
||||||
int (*hash_cmp)(const void *, const void *), const char *name);
|
bool (*hash_cmp)(const void *, const void *),
|
||||||
|
const char *name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve or insert data from / into a hash table.
|
* Retrieve or insert data from / into a hash table.
|
||||||
|
|
|
@ -117,7 +117,7 @@ static unsigned int if_rmap_hash_make(void *data)
|
||||||
return string_hash_make(if_rmap->ifname);
|
return string_hash_make(if_rmap->ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int if_rmap_hash_cmp(const void *arg1, const void *arg2)
|
static bool if_rmap_hash_cmp(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct if_rmap *if_rmap1 = arg1;
|
const struct if_rmap *if_rmap1 = arg1;
|
||||||
const struct if_rmap *if_rmap2 = arg2;
|
const struct if_rmap *if_rmap2 = arg2;
|
||||||
|
|
|
@ -36,7 +36,7 @@ static unsigned int qobj_key(void *data)
|
||||||
return (unsigned int)node->nid;
|
return (unsigned int)node->nid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qobj_cmp(const void *a, const void *b)
|
static bool qobj_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct qobj_node *na = a, *nb = b;
|
const struct qobj_node *na = a, *nb = b;
|
||||||
return na->nid == nb->nid;
|
return na->nid == nb->nid;
|
||||||
|
|
|
@ -631,7 +631,7 @@ static unsigned int route_map_hash_key_make(void *p)
|
||||||
return string_hash_make(map->name);
|
return string_hash_make(map->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int route_map_hash_cmp(const void *p1, const void *p2)
|
static bool route_map_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct route_map *map1 = p1;
|
const struct route_map *map1 = p1;
|
||||||
const struct route_map *map2 = p2;
|
const struct route_map *map2 = p2;
|
||||||
|
@ -639,14 +639,14 @@ static int route_map_hash_cmp(const void *p1, const void *p2)
|
||||||
if (map1->deleted == map2->deleted) {
|
if (map1->deleted == map2->deleted) {
|
||||||
if (map1->name && map2->name) {
|
if (map1->name && map2->name) {
|
||||||
if (!strcmp(map1->name, map2->name)) {
|
if (!strcmp(map1->name, map2->name)) {
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!map1->name && !map2->name) {
|
} else if (!map1->name && !map2->name) {
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum route_map_upd8_type {
|
enum route_map_upd8_type {
|
||||||
|
@ -676,7 +676,6 @@ struct route_map_dep {
|
||||||
struct hash *route_map_dep_hash[ROUTE_MAP_DEP_MAX];
|
struct hash *route_map_dep_hash[ROUTE_MAP_DEP_MAX];
|
||||||
|
|
||||||
static unsigned int route_map_dep_hash_make_key(void *p);
|
static unsigned int route_map_dep_hash_make_key(void *p);
|
||||||
static int route_map_dep_hash_cmp(const void *p1, const void *p2);
|
|
||||||
static void route_map_clear_all_references(char *rmap_name);
|
static void route_map_clear_all_references(char *rmap_name);
|
||||||
static void route_map_rule_delete(struct route_map_rule_list *,
|
static void route_map_rule_delete(struct route_map_rule_list *,
|
||||||
struct route_map_rule *);
|
struct route_map_rule *);
|
||||||
|
@ -1624,12 +1623,12 @@ void route_map_event_hook(void (*func)(route_map_event_t, const char *))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Routines for route map dependency lists and dependency processing */
|
/* Routines for route map dependency lists and dependency processing */
|
||||||
static int route_map_rmap_hash_cmp(const void *p1, const void *p2)
|
static bool route_map_rmap_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
return (strcmp((const char *)p1, (const char *)p2) == 0);
|
return (strcmp((const char *)p1, (const char *)p2) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int route_map_dep_hash_cmp(const void *p1, const void *p2)
|
static bool route_map_dep_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (strcmp(((const struct route_map_dep *)p1)->dep_name,
|
return (strcmp(((const struct route_map_dep *)p1)->dep_name,
|
||||||
|
|
|
@ -33,7 +33,7 @@ DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node")
|
||||||
|
|
||||||
static void route_table_free(struct route_table *);
|
static void route_table_free(struct route_table *);
|
||||||
|
|
||||||
static int route_table_hash_cmp(const void *a, const void *b)
|
static bool route_table_hash_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct prefix *pa = a, *pb = b;
|
const struct prefix *pa = a, *pb = b;
|
||||||
return prefix_cmp(pa, pb) == 0;
|
return prefix_cmp(pa, pb) == 0;
|
||||||
|
|
|
@ -68,7 +68,7 @@ static unsigned int cpu_record_hash_key(struct cpu_thread_history *a)
|
||||||
return jhash(&a->func, size, 0);
|
return jhash(&a->func, size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpu_record_hash_cmp(const struct cpu_thread_history *a,
|
static bool cpu_record_hash_cmp(const struct cpu_thread_history *a,
|
||||||
const struct cpu_thread_history *b)
|
const struct cpu_thread_history *b)
|
||||||
{
|
{
|
||||||
return a->func == b->func;
|
return a->func == b->func;
|
||||||
|
@ -434,7 +434,7 @@ struct thread_master *thread_master_create(const char *name)
|
||||||
|
|
||||||
rv->cpu_record = hash_create_size(
|
rv->cpu_record = hash_create_size(
|
||||||
8, (unsigned int (*)(void *))cpu_record_hash_key,
|
8, (unsigned int (*)(void *))cpu_record_hash_key,
|
||||||
(int (*)(const void *, const void *))cpu_record_hash_cmp,
|
(bool (*)(const void *, const void *))cpu_record_hash_cmp,
|
||||||
"Thread Hash");
|
"Thread Hash");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ static unsigned int vrf_hash_bitmap_key(void *data)
|
||||||
return bit->vrf_id;
|
return bit->vrf_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vrf_hash_bitmap_cmp(const void *a, const void *b)
|
static bool vrf_hash_bitmap_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct vrf_bit_set *bit1 = a;
|
const struct vrf_bit_set *bit1 = a;
|
||||||
const struct vrf_bit_set *bit2 = b;
|
const struct vrf_bit_set *bit2 = b;
|
||||||
|
|
|
@ -36,10 +36,12 @@ static unsigned int nhrp_cache_protocol_key(void *peer_data)
|
||||||
return sockunion_hash(&p->remote_addr);
|
return sockunion_hash(&p->remote_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nhrp_cache_protocol_cmp(const void *cache_data, const void *key_data)
|
static bool nhrp_cache_protocol_cmp(const void *cache_data,
|
||||||
|
const void *key_data)
|
||||||
{
|
{
|
||||||
const struct nhrp_cache *a = cache_data;
|
const struct nhrp_cache *a = cache_data;
|
||||||
const struct nhrp_cache *b = key_data;
|
const struct nhrp_cache *b = key_data;
|
||||||
|
|
||||||
return sockunion_same(&a->remote_addr, &b->remote_addr);
|
return sockunion_same(&a->remote_addr, &b->remote_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,10 +157,11 @@ static unsigned int nhrp_peer_key(void *peer_data)
|
||||||
return sockunion_hash(&p->vc->remote.nbma);
|
return sockunion_hash(&p->vc->remote.nbma);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nhrp_peer_cmp(const void *cache_data, const void *key_data)
|
static bool nhrp_peer_cmp(const void *cache_data, const void *key_data)
|
||||||
{
|
{
|
||||||
const struct nhrp_peer *a = cache_data;
|
const struct nhrp_peer *a = cache_data;
|
||||||
const struct nhrp_peer *b = key_data;
|
const struct nhrp_peer *b = key_data;
|
||||||
|
|
||||||
return a->ifp == b->ifp && a->vc == b->vc;
|
return a->ifp == b->ifp && a->vc == b->vc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,11 @@ static unsigned int nhrp_vc_key(void *peer_data)
|
||||||
sockunion_hash(&vc->remote.nbma), 0);
|
sockunion_hash(&vc->remote.nbma), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nhrp_vc_cmp(const void *cache_data, const void *key_data)
|
static bool nhrp_vc_cmp(const void *cache_data, const void *key_data)
|
||||||
{
|
{
|
||||||
const struct nhrp_vc *a = cache_data;
|
const struct nhrp_vc *a = cache_data;
|
||||||
const struct nhrp_vc *b = key_data;
|
const struct nhrp_vc *b = key_data;
|
||||||
|
|
||||||
return sockunion_same(&a->local.nbma, &b->local.nbma)
|
return sockunion_same(&a->local.nbma, &b->local.nbma)
|
||||||
&& sockunion_same(&a->remote.nbma, &b->remote.nbma);
|
&& sockunion_same(&a->remote.nbma, &b->remote.nbma);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@ static unsigned int nhrp_reqid_key(void *data)
|
||||||
return r->request_id;
|
return r->request_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nhrp_reqid_cmp(const void *data, const void *key)
|
static bool nhrp_reqid_cmp(const void *data, const void *key)
|
||||||
{
|
{
|
||||||
const struct nhrp_reqid *a = data, *b = key;
|
const struct nhrp_reqid *a = data, *b = key;
|
||||||
|
|
||||||
return a->request_id == b->request_id;
|
return a->request_id == b->request_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,11 @@ int ospf6_neighbor_cmp(void *va, void *vb)
|
||||||
{
|
{
|
||||||
struct ospf6_neighbor *ona = (struct ospf6_neighbor *)va;
|
struct ospf6_neighbor *ona = (struct ospf6_neighbor *)va;
|
||||||
struct ospf6_neighbor *onb = (struct ospf6_neighbor *)vb;
|
struct ospf6_neighbor *onb = (struct ospf6_neighbor *)vb;
|
||||||
return (ntohl(ona->router_id) < ntohl(onb->router_id) ? -1 : 1);
|
|
||||||
|
if (ona->router_id == onb->router_id)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (ntohl(ona->router_id) < ntohl(onb->router_id)) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id,
|
struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id,
|
||||||
|
|
|
@ -94,7 +94,7 @@ static unsigned int sr_hash(void *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare 2 Router ID hash entries based on SR Node */
|
/* Compare 2 Router ID hash entries based on SR Node */
|
||||||
static int sr_cmp(const void *p1, const void *p2)
|
static bool sr_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct sr_node *srn = p1;
|
const struct sr_node *srn = p1;
|
||||||
const struct in_addr *rid = p2;
|
const struct in_addr *rid = p2;
|
||||||
|
|
|
@ -69,7 +69,7 @@ static void *pbr_nhrc_hash_alloc(void *p)
|
||||||
return nhrc;
|
return nhrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pbr_nhrc_hash_equal(const void *arg1, const void *arg2)
|
static bool pbr_nhrc_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct nexthop *nh1, *nh2;
|
const struct nexthop *nh1, *nh2;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ static uint32_t pbr_nh_hash_key(void *arg)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pbr_nh_hash_equal(const void *arg1, const void *arg2)
|
static bool pbr_nh_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct pbr_nexthop_cache *pbrnc1 =
|
const struct pbr_nexthop_cache *pbrnc1 =
|
||||||
(const struct pbr_nexthop_cache *)arg1;
|
(const struct pbr_nexthop_cache *)arg1;
|
||||||
|
@ -147,24 +147,24 @@ static int pbr_nh_hash_equal(const void *arg1, const void *arg2)
|
||||||
(const struct pbr_nexthop_cache *)arg2;
|
(const struct pbr_nexthop_cache *)arg2;
|
||||||
|
|
||||||
if (pbrnc1->nexthop->vrf_id != pbrnc2->nexthop->vrf_id)
|
if (pbrnc1->nexthop->vrf_id != pbrnc2->nexthop->vrf_id)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (pbrnc1->nexthop->ifindex != pbrnc2->nexthop->ifindex)
|
if (pbrnc1->nexthop->ifindex != pbrnc2->nexthop->ifindex)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (pbrnc1->nexthop->type != pbrnc2->nexthop->type)
|
if (pbrnc1->nexthop->type != pbrnc2->nexthop->type)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
switch (pbrnc1->nexthop->type) {
|
switch (pbrnc1->nexthop->type) {
|
||||||
case NEXTHOP_TYPE_IFINDEX:
|
case NEXTHOP_TYPE_IFINDEX:
|
||||||
return 1;
|
return true;
|
||||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
return pbrnc1->nexthop->gate.ipv4.s_addr
|
return pbrnc1->nexthop->gate.ipv4.s_addr
|
||||||
== pbrnc2->nexthop->gate.ipv4.s_addr;
|
== pbrnc2->nexthop->gate.ipv4.s_addr;
|
||||||
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
||||||
case NEXTHOP_TYPE_IPV6:
|
case NEXTHOP_TYPE_IPV6:
|
||||||
return !memcmp(&pbrnc1->nexthop->gate.ipv6,
|
return !!memcmp(&pbrnc1->nexthop->gate.ipv6,
|
||||||
&pbrnc2->nexthop->gate.ipv6, 16);
|
&pbrnc2->nexthop->gate.ipv6, 16);
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
case NEXTHOP_TYPE_BLACKHOLE:
|
||||||
return pbrnc1->nexthop->bh_type == pbrnc2->nexthop->bh_type;
|
return pbrnc1->nexthop->bh_type == pbrnc2->nexthop->bh_type;
|
||||||
|
@ -173,7 +173,7 @@ static int pbr_nh_hash_equal(const void *arg1, const void *arg2)
|
||||||
/*
|
/*
|
||||||
* We should not get here
|
* We should not get here
|
||||||
*/
|
*/
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pbr_nhgc_delete(struct pbr_nexthop_group_cache *p)
|
static void pbr_nhgc_delete(struct pbr_nexthop_group_cache *p)
|
||||||
|
@ -724,7 +724,7 @@ static uint32_t pbr_nhg_hash_key(void *arg)
|
||||||
return jhash(&nhgc->name, strlen(nhgc->name), 0x52c34a96);
|
return jhash(&nhgc->name, strlen(nhgc->name), 0x52c34a96);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pbr_nhg_hash_equal(const void *arg1, const void *arg2)
|
static bool pbr_nhg_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct pbr_nexthop_group_cache *nhgc1 =
|
const struct pbr_nexthop_group_cache *nhgc1 =
|
||||||
(const struct pbr_nexthop_group_cache *)arg1;
|
(const struct pbr_nexthop_group_cache *)arg1;
|
||||||
|
|
|
@ -836,15 +836,15 @@ static unsigned int igmp_group_hash_key(void *arg)
|
||||||
return jhash_1word(group->group_addr.s_addr, 0);
|
return jhash_1word(group->group_addr.s_addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int igmp_group_hash_equal(const void *arg1, const void *arg2)
|
static bool igmp_group_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct igmp_group *g1 = (const struct igmp_group *)arg1;
|
const struct igmp_group *g1 = (const struct igmp_group *)arg1;
|
||||||
const struct igmp_group *g2 = (const struct igmp_group *)arg2;
|
const struct igmp_group *g2 = (const struct igmp_group *)arg2;
|
||||||
|
|
||||||
if (g1->group_addr.s_addr == g2->group_addr.s_addr)
|
if (g1->group_addr.s_addr == g2->group_addr.s_addr)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr,
|
static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr,
|
||||||
|
|
|
@ -687,7 +687,7 @@ static unsigned int pim_msdp_sa_hash_key_make(void *p)
|
||||||
return (jhash_2words(sa->sg.src.s_addr, sa->sg.grp.s_addr, 0));
|
return (jhash_2words(sa->sg.src.s_addr, sa->sg.grp.s_addr, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pim_msdp_sa_hash_eq(const void *p1, const void *p2)
|
static bool pim_msdp_sa_hash_eq(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct pim_msdp_sa *sa1 = p1;
|
const struct pim_msdp_sa *sa1 = p1;
|
||||||
const struct pim_msdp_sa *sa2 = p2;
|
const struct pim_msdp_sa *sa2 = p2;
|
||||||
|
@ -1221,7 +1221,7 @@ static unsigned int pim_msdp_peer_hash_key_make(void *p)
|
||||||
return (jhash_1word(mp->peer.s_addr, 0));
|
return (jhash_1word(mp->peer.s_addr, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pim_msdp_peer_hash_eq(const void *p1, const void *p2)
|
static bool pim_msdp_peer_hash_eq(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct pim_msdp_peer *mp1 = p1;
|
const struct pim_msdp_peer *mp1 = p1;
|
||||||
const struct pim_msdp_peer *mp2 = p2;
|
const struct pim_msdp_peer *mp2 = p2;
|
||||||
|
|
|
@ -79,16 +79,16 @@ static int pim_channel_oil_compare(struct channel_oil *c1,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pim_oil_equal(const void *arg1, const void *arg2)
|
static bool pim_oil_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct channel_oil *c1 = (const struct channel_oil *)arg1;
|
const struct channel_oil *c1 = (const struct channel_oil *)arg1;
|
||||||
const struct channel_oil *c2 = (const struct channel_oil *)arg2;
|
const struct channel_oil *c2 = (const struct channel_oil *)arg2;
|
||||||
|
|
||||||
if ((c1->oil.mfcc_mcastgrp.s_addr == c2->oil.mfcc_mcastgrp.s_addr)
|
if ((c1->oil.mfcc_mcastgrp.s_addr == c2->oil.mfcc_mcastgrp.s_addr)
|
||||||
&& (c1->oil.mfcc_origin.s_addr == c2->oil.mfcc_origin.s_addr))
|
&& (c1->oil.mfcc_origin.s_addr == c2->oil.mfcc_origin.s_addr))
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int pim_oil_hash_key(void *arg)
|
static unsigned int pim_oil_hash_key(void *arg)
|
||||||
|
|
|
@ -407,7 +407,7 @@ unsigned int pim_rpf_hash_key(void *arg)
|
||||||
return jhash_1word(r->rpf.rpf_addr.u.prefix4.s_addr, 0);
|
return jhash_1word(r->rpf.rpf_addr.u.prefix4.s_addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_rpf_equal(const void *arg1, const void *arg2)
|
bool pim_rpf_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct pim_nexthop_cache *r1 =
|
const struct pim_nexthop_cache *r1 =
|
||||||
(const struct pim_nexthop_cache *)arg1;
|
(const struct pim_nexthop_cache *)arg1;
|
||||||
|
|
|
@ -57,7 +57,7 @@ enum pim_rpf_result { PIM_RPF_OK = 0, PIM_RPF_CHANGED, PIM_RPF_FAILURE };
|
||||||
struct pim_upstream;
|
struct pim_upstream;
|
||||||
|
|
||||||
unsigned int pim_rpf_hash_key(void *arg);
|
unsigned int pim_rpf_hash_key(void *arg);
|
||||||
int pim_rpf_equal(const void *arg1, const void *arg2);
|
bool pim_rpf_equal(const void *arg1, const void *arg2);
|
||||||
|
|
||||||
int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
|
int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
|
||||||
struct in_addr addr, int neighbor_needed);
|
struct in_addr addr, int neighbor_needed);
|
||||||
|
|
|
@ -1554,16 +1554,16 @@ void pim_upstream_terminate(struct pim_instance *pim)
|
||||||
pim->upstream_sg_wheel = NULL;
|
pim->upstream_sg_wheel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_upstream_equal(const void *arg1, const void *arg2)
|
bool pim_upstream_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct pim_upstream *up1 = (const struct pim_upstream *)arg1;
|
const struct pim_upstream *up1 = (const struct pim_upstream *)arg1;
|
||||||
const struct pim_upstream *up2 = (const struct pim_upstream *)arg2;
|
const struct pim_upstream *up2 = (const struct pim_upstream *)arg2;
|
||||||
|
|
||||||
if ((up1->sg.grp.s_addr == up2->sg.grp.s_addr)
|
if ((up1->sg.grp.s_addr == up2->sg.grp.s_addr)
|
||||||
&& (up1->sg.src.s_addr == up2->sg.src.s_addr))
|
&& (up1->sg.src.s_addr == up2->sg.src.s_addr))
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rfc4601:section-4.2:"Data Packet Forwarding Rules" defines
|
/* rfc4601:section-4.2:"Data Packet Forwarding Rules" defines
|
||||||
|
|
|
@ -223,5 +223,5 @@ void pim_upstream_spt_prefix_list_update(struct pim_instance *pim,
|
||||||
struct prefix_list *pl);
|
struct prefix_list *pl);
|
||||||
|
|
||||||
unsigned int pim_upstream_hash_key(void *arg);
|
unsigned int pim_upstream_hash_key(void *arg);
|
||||||
int pim_upstream_equal(const void *arg1, const void *arg2);
|
bool pim_upstream_equal(const void *arg1, const void *arg2);
|
||||||
#endif /* PIM_UPSTREAM_H */
|
#endif /* PIM_UPSTREAM_H */
|
||||||
|
|
|
@ -172,7 +172,10 @@ void rip_peer_display(struct vty *vty)
|
||||||
|
|
||||||
static int rip_peer_list_cmp(struct rip_peer *p1, struct rip_peer *p2)
|
static int rip_peer_list_cmp(struct rip_peer *p1, struct rip_peer *p2)
|
||||||
{
|
{
|
||||||
return htonl(p1->addr.s_addr) > htonl(p2->addr.s_addr);
|
if (p2->addr.s_addr == p1->addr.s_addr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (htonl(p1->addr.s_addr) < htonl(p2->addr.s_addr)) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rip_peer_init(void)
|
void rip_peer_init(void)
|
||||||
|
|
|
@ -180,7 +180,7 @@ void ripng_peer_display(struct vty *vty)
|
||||||
|
|
||||||
static int ripng_peer_list_cmp(struct ripng_peer *p1, struct ripng_peer *p2)
|
static int ripng_peer_list_cmp(struct ripng_peer *p1, struct ripng_peer *p2)
|
||||||
{
|
{
|
||||||
return addr6_cmp(&p1->addr, &p2->addr) > 0;
|
return memcmp(&p1->addr, &p2->addr, sizeof(struct in6_addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ripng_peer_init()
|
void ripng_peer_init()
|
||||||
|
|
|
@ -234,13 +234,13 @@ static unsigned int static_nht_hash_key(void *data)
|
||||||
return jhash_1word(nhtd->nh_vrf_id, key);
|
return jhash_1word(nhtd->nh_vrf_id, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int static_nht_hash_cmp(const void *d1, const void *d2)
|
static bool static_nht_hash_cmp(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
const struct static_nht_data *nhtd1 = d1;
|
const struct static_nht_data *nhtd1 = d1;
|
||||||
const struct static_nht_data *nhtd2 = d2;
|
const struct static_nht_data *nhtd2 = d2;
|
||||||
|
|
||||||
if (nhtd1->nh_vrf_id != nhtd2->nh_vrf_id)
|
if (nhtd1->nh_vrf_id != nhtd2->nh_vrf_id)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return prefix_same(nhtd1->nh, nhtd2->nh);
|
return prefix_same(nhtd1->nh, nhtd2->nh);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ static zebra_fec_t *fec_add(struct route_table *table, struct prefix *p,
|
||||||
static int fec_del(zebra_fec_t *fec);
|
static int fec_del(zebra_fec_t *fec);
|
||||||
|
|
||||||
static unsigned int label_hash(void *p);
|
static unsigned int label_hash(void *p);
|
||||||
static int label_cmp(const void *p1, const void *p2);
|
static bool label_cmp(const void *p1, const void *p2);
|
||||||
static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
|
static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
|
||||||
struct nexthop *nexthop);
|
struct nexthop *nexthop);
|
||||||
static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
|
static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
|
||||||
|
@ -592,7 +592,7 @@ static unsigned int label_hash(void *p)
|
||||||
/*
|
/*
|
||||||
* Compare 2 LSP hash entries based on in-label.
|
* Compare 2 LSP hash entries based on in-label.
|
||||||
*/
|
*/
|
||||||
static int label_cmp(const void *p1, const void *p2)
|
static bool label_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const zebra_ile_t *ile1 = p1;
|
const zebra_ile_t *ile1 = p1;
|
||||||
const zebra_ile_t *ile2 = p2;
|
const zebra_ile_t *ile2 = p2;
|
||||||
|
|
|
@ -164,7 +164,7 @@ uint32_t zebra_pbr_rules_hash_key(void *arg)
|
||||||
jhash_1word(rule->rule.unique, key));
|
jhash_1word(rule->rule.unique, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
int zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
|
bool zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct zebra_pbr_rule *r1, *r2;
|
const struct zebra_pbr_rule *r1, *r2;
|
||||||
|
|
||||||
|
@ -172,36 +172,36 @@ int zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2)
|
||||||
r2 = (const struct zebra_pbr_rule *)arg2;
|
r2 = (const struct zebra_pbr_rule *)arg2;
|
||||||
|
|
||||||
if (r1->rule.seq != r2->rule.seq)
|
if (r1->rule.seq != r2->rule.seq)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->rule.priority != r2->rule.priority)
|
if (r1->rule.priority != r2->rule.priority)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->rule.unique != r2->rule.unique)
|
if (r1->rule.unique != r2->rule.unique)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->rule.action.table != r2->rule.action.table)
|
if (r1->rule.action.table != r2->rule.action.table)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->rule.filter.src_port != r2->rule.filter.src_port)
|
if (r1->rule.filter.src_port != r2->rule.filter.src_port)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->rule.filter.dst_port != r2->rule.filter.dst_port)
|
if (r1->rule.filter.dst_port != r2->rule.filter.dst_port)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->rule.filter.fwmark != r2->rule.filter.fwmark)
|
if (r1->rule.filter.fwmark != r2->rule.filter.fwmark)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (!prefix_same(&r1->rule.filter.src_ip, &r2->rule.filter.src_ip))
|
if (!prefix_same(&r1->rule.filter.src_ip, &r2->rule.filter.src_ip))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (!prefix_same(&r1->rule.filter.dst_ip, &r2->rule.filter.dst_ip))
|
if (!prefix_same(&r1->rule.filter.dst_ip, &r2->rule.filter.dst_ip))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->ifp != r2->ifp)
|
if (r1->ifp != r2->ifp)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pbr_rule_unique_lookup {
|
struct pbr_rule_unique_lookup {
|
||||||
|
@ -260,7 +260,7 @@ uint32_t zebra_pbr_ipset_hash_key(void *arg)
|
||||||
return jhash2(pnt, ZEBRA_IPSET_NAME_HASH_SIZE, 0x63ab42de);
|
return jhash2(pnt, ZEBRA_IPSET_NAME_HASH_SIZE, 0x63ab42de);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zebra_pbr_ipset_hash_equal(const void *arg1, const void *arg2)
|
bool zebra_pbr_ipset_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct zebra_pbr_ipset *r1, *r2;
|
const struct zebra_pbr_ipset *r1, *r2;
|
||||||
|
|
||||||
|
@ -268,13 +268,13 @@ int zebra_pbr_ipset_hash_equal(const void *arg1, const void *arg2)
|
||||||
r2 = (const struct zebra_pbr_ipset *)arg2;
|
r2 = (const struct zebra_pbr_ipset *)arg2;
|
||||||
|
|
||||||
if (r1->type != r2->type)
|
if (r1->type != r2->type)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->unique != r2->unique)
|
if (r1->unique != r2->unique)
|
||||||
return 0;
|
return false;
|
||||||
if (strncmp(r1->ipset_name, r2->ipset_name,
|
if (strncmp(r1->ipset_name, r2->ipset_name,
|
||||||
ZEBRA_IPSET_NAME_SIZE))
|
ZEBRA_IPSET_NAME_SIZE))
|
||||||
return 0;
|
return false;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zebra_pbr_ipset_entry_free(void *arg)
|
void zebra_pbr_ipset_entry_free(void *arg)
|
||||||
|
@ -313,7 +313,7 @@ uint32_t zebra_pbr_ipset_entry_hash_key(void *arg)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int zebra_pbr_ipset_entry_hash_equal(const void *arg1, const void *arg2)
|
bool zebra_pbr_ipset_entry_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct zebra_pbr_ipset_entry *r1, *r2;
|
const struct zebra_pbr_ipset_entry *r1, *r2;
|
||||||
|
|
||||||
|
@ -321,29 +321,29 @@ int zebra_pbr_ipset_entry_hash_equal(const void *arg1, const void *arg2)
|
||||||
r2 = (const struct zebra_pbr_ipset_entry *)arg2;
|
r2 = (const struct zebra_pbr_ipset_entry *)arg2;
|
||||||
|
|
||||||
if (r1->unique != r2->unique)
|
if (r1->unique != r2->unique)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (!prefix_same(&r1->src, &r2->src))
|
if (!prefix_same(&r1->src, &r2->src))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (!prefix_same(&r1->dst, &r2->dst))
|
if (!prefix_same(&r1->dst, &r2->dst))
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->src_port_min != r2->src_port_min)
|
if (r1->src_port_min != r2->src_port_min)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->src_port_max != r2->src_port_max)
|
if (r1->src_port_max != r2->src_port_max)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->dst_port_min != r2->dst_port_min)
|
if (r1->dst_port_min != r2->dst_port_min)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->dst_port_max != r2->dst_port_max)
|
if (r1->dst_port_max != r2->dst_port_max)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (r1->proto != r2->proto)
|
if (r1->proto != r2->proto)
|
||||||
return 0;
|
return false;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zebra_pbr_iptable_free(void *arg)
|
void zebra_pbr_iptable_free(void *arg)
|
||||||
|
@ -389,7 +389,7 @@ uint32_t zebra_pbr_iptable_hash_key(void *arg)
|
||||||
iptable->unique, key);
|
iptable->unique, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2)
|
bool zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
const struct zebra_pbr_iptable *r1, *r2;
|
const struct zebra_pbr_iptable *r1, *r2;
|
||||||
|
|
||||||
|
@ -397,31 +397,31 @@ int zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2)
|
||||||
r2 = (const struct zebra_pbr_iptable *)arg2;
|
r2 = (const struct zebra_pbr_iptable *)arg2;
|
||||||
|
|
||||||
if (r1->type != r2->type)
|
if (r1->type != r2->type)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->unique != r2->unique)
|
if (r1->unique != r2->unique)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->filter_bm != r2->filter_bm)
|
if (r1->filter_bm != r2->filter_bm)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->fwmark != r2->fwmark)
|
if (r1->fwmark != r2->fwmark)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->action != r2->action)
|
if (r1->action != r2->action)
|
||||||
return 0;
|
return false;
|
||||||
if (strncmp(r1->ipset_name, r2->ipset_name,
|
if (strncmp(r1->ipset_name, r2->ipset_name,
|
||||||
ZEBRA_IPSET_NAME_SIZE))
|
ZEBRA_IPSET_NAME_SIZE))
|
||||||
return 0;
|
return false;
|
||||||
if (r1->pkt_len_min != r2->pkt_len_min)
|
if (r1->pkt_len_min != r2->pkt_len_min)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->pkt_len_max != r2->pkt_len_max)
|
if (r1->pkt_len_max != r2->pkt_len_max)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->tcp_flags != r2->tcp_flags)
|
if (r1->tcp_flags != r2->tcp_flags)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->tcp_mask_flags != r2->tcp_mask_flags)
|
if (r1->tcp_mask_flags != r2->tcp_mask_flags)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->dscp_value != r2->dscp_value)
|
if (r1->dscp_value != r2->dscp_value)
|
||||||
return 0;
|
return false;
|
||||||
if (r1->fragment != r2->fragment)
|
if (r1->fragment != r2->fragment)
|
||||||
return 0;
|
return false;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *pbr_rule_alloc_intern(void *arg)
|
static void *pbr_rule_alloc_intern(void *arg)
|
||||||
|
|
|
@ -213,7 +213,7 @@ extern int kernel_pbr_rule_del(struct zebra_pbr_rule *rule);
|
||||||
|
|
||||||
extern void zebra_pbr_rules_free(void *arg);
|
extern void zebra_pbr_rules_free(void *arg);
|
||||||
extern uint32_t zebra_pbr_rules_hash_key(void *arg);
|
extern uint32_t zebra_pbr_rules_hash_key(void *arg);
|
||||||
extern int zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2);
|
extern bool zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2);
|
||||||
|
|
||||||
/* has operates on 32bit pointer
|
/* has operates on 32bit pointer
|
||||||
* and field is a string of 8bit
|
* and field is a string of 8bit
|
||||||
|
@ -222,15 +222,16 @@ extern int zebra_pbr_rules_hash_equal(const void *arg1, const void *arg2);
|
||||||
|
|
||||||
extern void zebra_pbr_ipset_free(void *arg);
|
extern void zebra_pbr_ipset_free(void *arg);
|
||||||
extern uint32_t zebra_pbr_ipset_hash_key(void *arg);
|
extern uint32_t zebra_pbr_ipset_hash_key(void *arg);
|
||||||
extern int zebra_pbr_ipset_hash_equal(const void *arg1, const void *arg2);
|
extern bool zebra_pbr_ipset_hash_equal(const void *arg1, const void *arg2);
|
||||||
|
|
||||||
extern void zebra_pbr_ipset_entry_free(void *arg);
|
extern void zebra_pbr_ipset_entry_free(void *arg);
|
||||||
extern uint32_t zebra_pbr_ipset_entry_hash_key(void *arg);
|
extern uint32_t zebra_pbr_ipset_entry_hash_key(void *arg);
|
||||||
extern int zebra_pbr_ipset_entry_hash_equal(const void *arg1, const void *arg2);
|
extern bool zebra_pbr_ipset_entry_hash_equal(const void *arg1,
|
||||||
|
const void *arg2);
|
||||||
|
|
||||||
extern void zebra_pbr_iptable_free(void *arg);
|
extern void zebra_pbr_iptable_free(void *arg);
|
||||||
extern uint32_t zebra_pbr_iptable_hash_key(void *arg);
|
extern uint32_t zebra_pbr_iptable_hash_key(void *arg);
|
||||||
extern int zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2);
|
extern bool zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2);
|
||||||
|
|
||||||
extern void zebra_pbr_init(void);
|
extern void zebra_pbr_init(void);
|
||||||
extern void zebra_pbr_show_ipset_list(struct vty *vty, char *ipsetname);
|
extern void zebra_pbr_show_ipset_list(struct vty *vty, char *ipsetname);
|
||||||
|
|
|
@ -81,7 +81,6 @@ static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr,
|
||||||
struct ipaddr *ip, uint8_t flags,
|
struct ipaddr *ip, uint8_t flags,
|
||||||
uint32_t seq, uint16_t cmd);
|
uint32_t seq, uint16_t cmd);
|
||||||
static unsigned int neigh_hash_keymake(void *p);
|
static unsigned int neigh_hash_keymake(void *p);
|
||||||
static int neigh_cmp(const void *p1, const void *p2);
|
|
||||||
static void *zvni_neigh_alloc(void *p);
|
static void *zvni_neigh_alloc(void *p);
|
||||||
static zebra_neigh_t *zvni_neigh_add(zebra_vni_t *zvni, struct ipaddr *ip,
|
static zebra_neigh_t *zvni_neigh_add(zebra_vni_t *zvni, struct ipaddr *ip,
|
||||||
struct ethaddr *mac);
|
struct ethaddr *mac);
|
||||||
|
@ -137,7 +136,7 @@ static void zebra_vxlan_process_l3vni_oper_up(zebra_l3vni_t *zl3vni);
|
||||||
static void zebra_vxlan_process_l3vni_oper_down(zebra_l3vni_t *zl3vni);
|
static void zebra_vxlan_process_l3vni_oper_down(zebra_l3vni_t *zl3vni);
|
||||||
|
|
||||||
static unsigned int mac_hash_keymake(void *p);
|
static unsigned int mac_hash_keymake(void *p);
|
||||||
static int mac_cmp(const void *p1, const void *p2);
|
static bool mac_cmp(const void *p1, const void *p2);
|
||||||
static void *zvni_mac_alloc(void *p);
|
static void *zvni_mac_alloc(void *p);
|
||||||
static zebra_mac_t *zvni_mac_add(zebra_vni_t *zvni, struct ethaddr *macaddr);
|
static zebra_mac_t *zvni_mac_add(zebra_vni_t *zvni, struct ethaddr *macaddr);
|
||||||
static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac);
|
static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac);
|
||||||
|
@ -157,7 +156,6 @@ static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac);
|
||||||
static void zvni_install_mac_hash(struct hash_backet *backet, void *ctxt);
|
static void zvni_install_mac_hash(struct hash_backet *backet, void *ctxt);
|
||||||
|
|
||||||
static unsigned int vni_hash_keymake(void *p);
|
static unsigned int vni_hash_keymake(void *p);
|
||||||
static int vni_hash_cmp(const void *p1, const void *p2);
|
|
||||||
static void *zvni_alloc(void *p);
|
static void *zvni_alloc(void *p);
|
||||||
static zebra_vni_t *zvni_lookup(vni_t vni);
|
static zebra_vni_t *zvni_lookup(vni_t vni);
|
||||||
static zebra_vni_t *zvni_add(vni_t vni);
|
static zebra_vni_t *zvni_add(vni_t vni);
|
||||||
|
@ -1254,20 +1252,28 @@ static unsigned int neigh_hash_keymake(void *p)
|
||||||
/*
|
/*
|
||||||
* Compare two neighbor hash structures.
|
* Compare two neighbor hash structures.
|
||||||
*/
|
*/
|
||||||
static int neigh_cmp(const void *p1, const void *p2)
|
static bool neigh_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const zebra_neigh_t *n1 = p1;
|
const zebra_neigh_t *n1 = p1;
|
||||||
const zebra_neigh_t *n2 = p2;
|
const zebra_neigh_t *n2 = p2;
|
||||||
|
|
||||||
if (n1 == NULL && n2 == NULL)
|
if (n1 == NULL && n2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (n1 == NULL || n2 == NULL)
|
if (n1 == NULL || n2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return (memcmp(&n1->ip, &n2->ip, sizeof(struct ipaddr)) == 0);
|
return (memcmp(&n1->ip, &n2->ip, sizeof(struct ipaddr)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int neigh_list_cmp(void *p1, void *p2)
|
||||||
|
{
|
||||||
|
const zebra_neigh_t *n1 = p1;
|
||||||
|
const zebra_neigh_t *n2 = p2;
|
||||||
|
|
||||||
|
return memcmp(&n1->ip, &n2->ip, sizeof(struct ipaddr));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback to allocate neighbor hash entry.
|
* Callback to allocate neighbor hash entry.
|
||||||
*/
|
*/
|
||||||
|
@ -2232,16 +2238,16 @@ static unsigned int mac_hash_keymake(void *p)
|
||||||
/*
|
/*
|
||||||
* Compare two MAC addresses.
|
* Compare two MAC addresses.
|
||||||
*/
|
*/
|
||||||
static int mac_cmp(const void *p1, const void *p2)
|
static bool mac_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const zebra_mac_t *pmac1 = p1;
|
const zebra_mac_t *pmac1 = p1;
|
||||||
const zebra_mac_t *pmac2 = p2;
|
const zebra_mac_t *pmac2 = p2;
|
||||||
|
|
||||||
if (pmac1 == NULL && pmac2 == NULL)
|
if (pmac1 == NULL && pmac2 == NULL)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (pmac1 == NULL || pmac2 == NULL)
|
if (pmac1 == NULL || pmac2 == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return (memcmp(pmac1->macaddr.octet, pmac2->macaddr.octet, ETH_ALEN)
|
return (memcmp(pmac1->macaddr.octet, pmac2->macaddr.octet, ETH_ALEN)
|
||||||
== 0);
|
== 0);
|
||||||
|
@ -2275,7 +2281,7 @@ static zebra_mac_t *zvni_mac_add(zebra_vni_t *zvni, struct ethaddr *macaddr)
|
||||||
assert(mac);
|
assert(mac);
|
||||||
|
|
||||||
mac->neigh_list = list_new();
|
mac->neigh_list = list_new();
|
||||||
mac->neigh_list->cmp = (int (*)(void *, void *))neigh_cmp;
|
mac->neigh_list->cmp = neigh_list_cmp;
|
||||||
|
|
||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
|
@ -2753,7 +2759,7 @@ static unsigned int vni_hash_keymake(void *p)
|
||||||
/*
|
/*
|
||||||
* Compare 2 VNI hash entries.
|
* Compare 2 VNI hash entries.
|
||||||
*/
|
*/
|
||||||
static int vni_hash_cmp(const void *p1, const void *p2)
|
static bool vni_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const zebra_vni_t *zvni1 = p1;
|
const zebra_vni_t *zvni1 = p1;
|
||||||
const zebra_vni_t *zvni2 = p2;
|
const zebra_vni_t *zvni2 = p2;
|
||||||
|
@ -2761,6 +2767,16 @@ static int vni_hash_cmp(const void *p1, const void *p2)
|
||||||
return (zvni1->vni == zvni2->vni);
|
return (zvni1->vni == zvni2->vni);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vni_list_cmp(void *p1, void *p2)
|
||||||
|
{
|
||||||
|
const zebra_vni_t *zvni1 = p1;
|
||||||
|
const zebra_vni_t *zvni2 = p2;
|
||||||
|
|
||||||
|
if (zvni1->vni == zvni2->vni)
|
||||||
|
return 0;
|
||||||
|
return (zvni1->vni < zvni2->vni) ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback to allocate VNI hash entry.
|
* Callback to allocate VNI hash entry.
|
||||||
*/
|
*/
|
||||||
|
@ -3601,7 +3617,7 @@ static unsigned int l3vni_hash_keymake(void *p)
|
||||||
/*
|
/*
|
||||||
* Compare 2 L3 VNI hash entries.
|
* Compare 2 L3 VNI hash entries.
|
||||||
*/
|
*/
|
||||||
static int l3vni_hash_cmp(const void *p1, const void *p2)
|
static bool l3vni_hash_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const zebra_l3vni_t *zl3vni1 = p1;
|
const zebra_l3vni_t *zl3vni1 = p1;
|
||||||
const zebra_l3vni_t *zl3vni2 = p2;
|
const zebra_l3vni_t *zl3vni2 = p2;
|
||||||
|
@ -3662,7 +3678,7 @@ static zebra_l3vni_t *zl3vni_add(vni_t vni, vrf_id_t vrf_id)
|
||||||
zl3vni->svi_if = NULL;
|
zl3vni->svi_if = NULL;
|
||||||
zl3vni->vxlan_if = NULL;
|
zl3vni->vxlan_if = NULL;
|
||||||
zl3vni->l2vnis = list_new();
|
zl3vni->l2vnis = list_new();
|
||||||
zl3vni->l2vnis->cmp = (int (*)(void *, void *))vni_hash_cmp;
|
zl3vni->l2vnis->cmp = vni_list_cmp;
|
||||||
|
|
||||||
/* Create hash table for remote RMAC */
|
/* Create hash table for remote RMAC */
|
||||||
zl3vni->rmac_table = hash_create(mac_hash_keymake, mac_cmp,
|
zl3vni->rmac_table = hash_create(mac_hash_keymake, mac_cmp,
|
||||||
|
|
Loading…
Reference in a new issue