diff options
author | Christian Franke <chris@opensourcerouting.org> | 2017-08-03 13:37:38 +0200 |
---|---|---|
committer | Christian Franke <chris@opensourcerouting.org> | 2017-08-03 13:37:58 +0200 |
commit | 7a7761d21c9301bdfffc5f3faa2318819c6a0460 (patch) | |
tree | 66e239089521b512167c91c2c6c96680a64beff6 /lib/prefix.c | |
parent | isisd: make isis_spftree non-public (diff) | |
download | frr-7a7761d21c9301bdfffc5f3faa2318819c6a0460.tar.xz frr-7a7761d21c9301bdfffc5f3faa2318819c6a0460.zip |
lib: move prefix hash key to prefix.c to allow global use
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r-- | lib/prefix.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index 0ba0025c6..47e16dbf8 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -26,6 +26,7 @@ #include "sockunion.h" #include "memory.h" #include "log.h" +#include "jhash.h" DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix") @@ -1335,3 +1336,15 @@ char *prefix_mac2str(const struct ethaddr *mac, char *buf, int size) (uint8_t)mac->octet[4], (uint8_t)mac->octet[5]); return ptr; } + +unsigned prefix_hash_key(void *pp) +{ + struct prefix copy; + + /* make sure *all* unused bits are zero, particularly including + * alignment / + * padding and unused prefix bytes. */ + memset(©, 0, sizeof(copy)); + prefix_copy(©, (struct prefix *)pp); + return jhash(©, sizeof(copy), 0x55aa5a5a); +} |