summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-10-17 21:27:12 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-10-19 19:14:45 +0200
commit74df8d6d9d665784b0273151fe04cd2f9ff5b353 (patch)
tree7b0d38ba7c6e9605634d40a64c4b904295d59d80 /nhrpd
parent*: Fixup to use proper list_cmp functions (diff)
downloadfrr-74df8d6d9d665784b0273151fe04cd2f9ff5b353.tar.xz
frr-74df8d6d9d665784b0273151fe04cd2f9ff5b353.zip
*: Replace hash_cmp function return value to a bool
The ->hash_cmp and linked list ->cmp functions were sometimes being used interchangeably and this really is not a good thing. So let's modify the hash_cmp function pointer to return a boolean and convert everything to use the new syntax. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/nhrp_cache.c4
-rw-r--r--nhrpd/nhrp_peer.c3
-rw-r--r--nhrpd/nhrp_vc.c3
-rw-r--r--nhrpd/reqid.c3
4 files changed, 9 insertions, 4 deletions
diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c
index f3a33eb28..1316a4aad 100644
--- a/nhrpd/nhrp_cache.c
+++ b/nhrpd/nhrp_cache.c
@@ -36,10 +36,12 @@ static unsigned int nhrp_cache_protocol_key(void *peer_data)
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 *b = key_data;
+
return sockunion_same(&a->remote_addr, &b->remote_addr);
}
diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c
index 203d4aa98..db2f72ac2 100644
--- a/nhrpd/nhrp_peer.c
+++ b/nhrpd/nhrp_peer.c
@@ -157,10 +157,11 @@ static unsigned int nhrp_peer_key(void *peer_data)
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 *b = key_data;
+
return a->ifp == b->ifp && a->vc == b->vc;
}
diff --git a/nhrpd/nhrp_vc.c b/nhrpd/nhrp_vc.c
index 41a87d4ad..79a655396 100644
--- a/nhrpd/nhrp_vc.c
+++ b/nhrpd/nhrp_vc.c
@@ -35,10 +35,11 @@ static unsigned int nhrp_vc_key(void *peer_data)
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 *b = key_data;
+
return sockunion_same(&a->local.nbma, &b->local.nbma)
&& sockunion_same(&a->remote.nbma, &b->remote.nbma);
}
diff --git a/nhrpd/reqid.c b/nhrpd/reqid.c
index e8ad518e5..08a007bdf 100644
--- a/nhrpd/reqid.c
+++ b/nhrpd/reqid.c
@@ -8,9 +8,10 @@ static unsigned int nhrp_reqid_key(void *data)
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;
+
return a->request_id == b->request_id;
}