diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-12-07 14:11:28 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-12-07 14:20:52 +0100 |
commit | d15b0b0a1b494c14b139d2d28706d82cd6e2f139 (patch) | |
tree | f704869689e1acab9a4f3417849ac5853188310d /lib/net.c | |
parent | 5df4073c81942ea119de90a81431bae71c87157b (diff) |
BGP redesign
Integrated and extensible BGP with generalized AFI handling,
support for IPv4+IPv6 AFI and unicast+multicast SAFI.
Diffstat (limited to 'lib/net.c')
-rw-r--r-- | lib/net.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -109,6 +109,24 @@ net_compare(const net_addr *a, const net_addr *b) return 0; } +#define NET_HASH(a,t) net_hash_##t((const net_addr_##t *) a) + +u32 +net_hash(const net_addr *n) +{ + switch (n->type) + { + case NET_IP4: return NET_HASH(n, ip4); + case NET_IP6: return NET_HASH(n, ip6); + case NET_VPN4: return NET_HASH(n, vpn4); + case NET_VPN6: return NET_HASH(n, vpn6); + case NET_ROA4: return NET_HASH(n, roa4); + case NET_ROA6: return NET_HASH(n, roa6); + default: bug("invalid type"); + } +} + + int net_validate(const net_addr *N) { |