diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-01-24 13:55:12 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-01-24 13:55:12 +0100 |
commit | 345e50d59ff299e466fab6d0e0d37c210d624d96 (patch) | |
tree | e06cc72776a5c2c01e16233d2379e8d6b692e30e /nest | |
parent | 75d98b6013c19598b1d3ba5e05e8f84525e8678a (diff) |
Nest: remove duplicate function
Diffstat (limited to 'nest')
-rw-r--r-- | nest/rt-fib.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/nest/rt-fib.c b/nest/rt-fib.c index 24a7facc..c09f2759 100644 --- a/nest/rt-fib.c +++ b/nest/rt-fib.c @@ -92,8 +92,7 @@ fib_ht_free(struct fib_node **h) } -static u32 -fib_hash(struct fib *f, const net_addr *a); +static inline u32 fib_hash(struct fib *f, const net_addr *a); /** * fib_init - initialize a new FIB @@ -198,24 +197,11 @@ fib_rehash(struct fib *f, int step) }) -static u32 +static inline u32 fib_hash(struct fib *f, const net_addr *a) { - ASSERT(f->addr_type == a->type); - - switch (f->addr_type) - { - case NET_IP4: return FIB_HASH(f, a, ip4); - case NET_IP6: return FIB_HASH(f, a, ip6); - case NET_VPN4: return FIB_HASH(f, a, vpn4); - case NET_VPN6: return FIB_HASH(f, a, vpn6); - case NET_ROA4: return FIB_HASH(f, a, roa4); - case NET_ROA6: return FIB_HASH(f, a, roa6); - case NET_FLOW4: return FIB_HASH(f, a, flow4); - case NET_FLOW6: return FIB_HASH(f, a, flow6); - case NET_MPLS: return FIB_HASH(f, a, mpls); - default: bug("invalid type"); - } + /* Same as FIB_HASH() */ + return net_hash(a) >> f->hash_shift; } void * |