]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: reduce attrhash_make_key() indirections
authorJorge Boncompte [DTI2] <jorge@dti2.net>
Mon, 7 May 2012 16:52:58 +0000 (16:52 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 22 May 2012 18:25:49 +0000 (20:25 +0200)
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_attr.c

index 7c0f6cc6de090fe943c38054d0c24290844b8957..96429090af562ffe84d80b291b552826ed1f0590 100644 (file)
@@ -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 */
     }