summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_pbr.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-05-14 22:19:07 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-05-14 23:23:08 +0200
commitd8b87afe7c5fcee9caaef7124d5bcd5f0c3af8a1 (patch)
treeca07ea6097ec12120806ff4c7bd268b9fc063842 /zebra/zebra_pbr.c
parentMerge pull request #4335 from opensourcerouting/zebra-fpm-blackhole-info (diff)
downloadfrr-d8b87afe7c5fcee9caaef7124d5bcd5f0c3af8a1.tar.xz
frr-d8b87afe7c5fcee9caaef7124d5bcd5f0c3af8a1.zip
lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_pbr.c')
-rw-r--r--zebra/zebra_pbr.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 73db567ea..a82dd4c24 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -135,12 +135,12 @@ void zebra_pbr_rules_free(void *arg)
XFREE(MTYPE_TMP, rule);
}
-uint32_t zebra_pbr_rules_hash_key(void *arg)
+uint32_t zebra_pbr_rules_hash_key(const void *arg)
{
- struct zebra_pbr_rule *rule;
+ const struct zebra_pbr_rule *rule;
uint32_t key;
- rule = (struct zebra_pbr_rule *)arg;
+ rule = arg;
key = jhash_3words(rule->rule.seq, rule->rule.priority,
rule->rule.action.table,
prefix_hash_key(&rule->rule.filter.src_ip));
@@ -250,9 +250,9 @@ void zebra_pbr_ipset_free(void *arg)
XFREE(MTYPE_TMP, ipset);
}
-uint32_t zebra_pbr_ipset_hash_key(void *arg)
+uint32_t zebra_pbr_ipset_hash_key(const void *arg)
{
- struct zebra_pbr_ipset *ipset = (struct zebra_pbr_ipset *)arg;
+ const struct zebra_pbr_ipset *ipset = arg;
uint32_t *pnt = (uint32_t *)&ipset->ipset_name;
uint32_t key = jhash_1word(ipset->vrf_id, 0x63ab42de);
@@ -290,12 +290,12 @@ void zebra_pbr_ipset_entry_free(void *arg)
XFREE(MTYPE_TMP, ipset);
}
-uint32_t zebra_pbr_ipset_entry_hash_key(void *arg)
+uint32_t zebra_pbr_ipset_entry_hash_key(const void *arg)
{
- struct zebra_pbr_ipset_entry *ipset;
+ const struct zebra_pbr_ipset_entry *ipset;
uint32_t key;
- ipset = (struct zebra_pbr_ipset_entry *)arg;
+ ipset = arg;
key = prefix_hash_key(&ipset->src);
key = jhash_1word(ipset->unique, key);
key = jhash_1word(prefix_hash_key(&ipset->dst), key);
@@ -359,9 +359,9 @@ void zebra_pbr_iptable_free(void *arg)
XFREE(MTYPE_TMP, iptable);
}
-uint32_t zebra_pbr_iptable_hash_key(void *arg)
+uint32_t zebra_pbr_iptable_hash_key(const void *arg)
{
- struct zebra_pbr_iptable *iptable = (struct zebra_pbr_iptable *)arg;
+ const struct zebra_pbr_iptable *iptable = arg;
uint32_t *pnt = (uint32_t *)&(iptable->ipset_name);
uint32_t key;