Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Quagga: Dev

[PATCH 09/25] bgpd: use on stack struct attr_extra on bgp_attr_aggregate_intern()

 

 

Quagga dev RSS feed   Index | Next | Previous | View Threaded


jorge at dti2

May 7, 2012, 10:52 AM

Post #1 of 1 (82 views)
Permalink
[PATCH 09/25] bgpd: use on stack struct attr_extra on bgp_attr_aggregate_intern()

From: "Jorge Boncompte [DTI2]" <jorge [at] dti2>

Reduce memory heap fragmentation and pressure on the memory allocator.

Signed-off-by: Jorge Boncompte [DTI2] <jorge [at] dti2>
---
bgpd/bgp_attr.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 9642909..bb21fe1 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -577,11 +577,12 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
{
struct attr attr;
struct attr *new;
- struct attr_extra *attre;
+ struct attr_extra attre;

memset (&attr, 0, sizeof (struct attr));
- attre = bgp_attr_extra_get (&attr);
-
+ memset (&attre, 0, sizeof (struct attr_extra));
+ attr.extra = &attre;
+
/* Origin attribute. */
attr.origin = origin;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGIN);
@@ -602,22 +603,21 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES);
}

- attre->weight = BGP_ATTR_DEFAULT_WEIGHT;
+ attre.weight = BGP_ATTR_DEFAULT_WEIGHT;
#ifdef HAVE_IPV6
- attre->mp_nexthop_len = IPV6_MAX_BYTELEN;
+ attre.mp_nexthop_len = IPV6_MAX_BYTELEN;
#endif
if (! as_set)
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE);
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION))
- attre->aggregator_as = bgp->confed_id;
+ attre.aggregator_as = bgp->confed_id;
else
- attre->aggregator_as = bgp->as;
- attre->aggregator_addr = bgp->router_id;
+ attre.aggregator_as = bgp->as;
+ attre.aggregator_addr = bgp->router_id;

new = bgp_attr_intern (&attr);
- bgp_attr_extra_free (&attr);
-
+
aspath_unintern (&new->aspath);
return new;
}
--
1.7.8.3


_______________________________________________
Quagga-dev mailing list
Quagga-dev [at] lists
http://lists.quagga.net/mailman/listinfo/quagga-dev

Quagga dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.