summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-05-07 16:52:58 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-05-22 20:25:49 +0200
commit7fb0cd82c26492004a106bec7ca4afdf4684fabb (patch)
tree1f901bbc121337b9c421eb48d7bcc413ad140753
parente16a413313cf985ae2b8d2f1a9e8fd0ab6f5b9fc (diff)
bgpd: reduce attrhash_make_key() indirections
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_attr.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 7c0f6cc6..96429090 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -342,7 +342,8 @@ attr_unknown_count (void)
unsigned int
attrhash_key_make (void *p)
{
- const struct attr * attr = (struct attr *) p;
+ const struct attr *attr = (struct attr *) p;
+ const struct attr_extra *extra = attr->extra;
uint32_t key = 0;
#define MIX(val) key = jhash_1word(val, key)
@@ -356,12 +357,12 @@ attrhash_key_make (void *p)
key += attr->med;
key += attr->local_pref;
- if (attr->extra)
+ if (extra)
{
- MIX(attr->extra->aggregator_as);
- MIX(attr->extra->aggregator_addr.s_addr);
- MIX(attr->extra->weight);
- MIX(attr->extra->mp_nexthop_global_in.s_addr);
+ MIX(extra->aggregator_as);
+ MIX(extra->aggregator_addr.s_addr);
+ MIX(extra->weight);
+ MIX(extra->mp_nexthop_global_in.s_addr);
}
if (attr->aspath)
@@ -369,19 +370,19 @@ attrhash_key_make (void *p)
if (attr->community)
MIX(community_hash_make (attr->community));
- if (attr->extra)
+ if (extra)
{
- if (attr->extra->ecommunity)
- MIX(ecommunity_hash_make (attr->extra->ecommunity));
- if (attr->extra->cluster)
- MIX(cluster_hash_key_make (attr->extra->cluster));
- if (attr->extra->transit)
- MIX(transit_hash_key_make (attr->extra->transit));
+ if (extra->ecommunity)
+ MIX(ecommunity_hash_make (extra->ecommunity));
+ if (extra->cluster)
+ MIX(cluster_hash_key_make (extra->cluster));
+ if (extra->transit)
+ MIX(transit_hash_key_make (extra->transit));
#ifdef HAVE_IPV6
- MIX(attr->extra->mp_nexthop_len);
- key = jhash(attr->extra->mp_nexthop_global.s6_addr, 16, key);
- key = jhash(attr->extra->mp_nexthop_local.s6_addr, 16, key);
+ MIX(extra->mp_nexthop_len);
+ key = jhash(extra->mp_nexthop_global.s6_addr, 16, key);
+ key = jhash(extra->mp_nexthop_local.s6_addr, 16, key);
#endif /* HAVE_IPV6 */
}