[bgpd] rearrange some structs for less padding, stats for table/attrs.

2006-03-12 Paul Jakma <paul.jakma@sun.com>

	* bgp_attr.h: (struct attr) rearrange fields to avoid
	  wasted padding between them as much as possible.
	  (attr_count,attr_unknown_count) export new functions to
	  return number of counts of cached attributes.
	* bgp_attr.c: (attr_count,attr_unknown_count) new functions to
	  return number of counts of cached attributes.
	* bgp_route.h: (struct bgp_info) rearrange fields to avoid
	  wasted padding.
	* bgp_table.h: (struct bgp_table) Add a count field, of number
	  of nodes in the table.
	  (struct bgp_node)  rearrange fields to avoid
	  wasted padding between them, though I don't think there
	  was any in this case.
	* bgp_table.c: (bgp_node_{delete,get}) Maintain the table node count.
	  (bgp_table_count) new function to access the table count.
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 24be30f..e5f3ae5 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -29,20 +29,27 @@
   struct bgp_info *next;
   struct bgp_info *prev;
   
+  /* Peer structure.  */
+  struct peer *peer;
+
+  /* Attribute structure.  */
+  struct attr *attr;
+
+  /* Pointer to dampening structure.  */
+  struct bgp_damp_info *damp_info;
+
+  /* Uptime.  */
+  time_t uptime;
+
+  /* This route is suppressed with aggregation.  */
+  int suppress;
+  
+  /* Nexthop reachability check.  */
+  u_int32_t igpmetric;
+
   /* reference count */
   unsigned int lock;
   
-  /* BGP route type.  This can be static, RIP, OSPF, BGP etc.  */
-  u_char type;
-
-  /* When above type is BGP.  This sub type specify BGP sub type
-     information.  */
-  u_char sub_type;
-#define BGP_ROUTE_NORMAL       0
-#define BGP_ROUTE_STATIC       1
-#define BGP_ROUTE_AGGREGATE    2
-#define BGP_ROUTE_REDISTRIBUTE 3 
-
   /* BGP information status.  */
   u_int16_t flags;
 #define BGP_INFO_IGP_CHANGED    (1 << 0)
@@ -57,26 +64,19 @@
 #define BGP_INFO_REMOVED        (1 << 9)
 #define BGP_INFO_COUNTED	(1 << 10)
 
-  /* Peer structure.  */
-  struct peer *peer;
-
-  /* Attribute structure.  */
-  struct attr *attr;
-
-  /* This route is suppressed with aggregation.  */
-  int suppress;
-  
-  /* Nexthop reachability check.  */
-  u_int32_t igpmetric;
-
-  /* Uptime.  */
-  time_t uptime;
-
-  /* Pointer to dampening structure.  */
-  struct bgp_damp_info *damp_info;
-
   /* MPLS label.  */
   u_char tag[3];
+
+  /* BGP route type.  This can be static, RIP, OSPF, BGP etc.  */
+  u_char type;
+
+  /* When above type is BGP.  This sub type specify BGP sub type
+     information.  */
+  u_char sub_type;
+#define BGP_ROUTE_NORMAL       0
+#define BGP_ROUTE_STATIC       1
+#define BGP_ROUTE_AGGREGATE    2
+#define BGP_ROUTE_REDISTRIBUTE 3 
 };
 
 /* BGP static route configuration. */