]> git.proxmox.com Git - mirror_frr.git/commitdiff
[bgpd] Use defines for default weight
authorPaul Jakma <paul.jakma@sun.com>
Sun, 29 Apr 2007 18:31:07 +0000 (18:31 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Sun, 29 Apr 2007 18:31:07 +0000 (18:31 +0000)
2007-04-22 Sebastien Tandel <sebastien@tandel.be>

* bgp_attr.h : Definition of BGP_ATTR_DEFAULT_WEIGHT.
* bgp_attr.c : (bgp_attr_default_intern) now uses
  bgp_attr_default_set instead of duplicating the same code.
  (general) Use of BGP_ATTR_DEFAULT_WEIGHT. Replace two 16 by
  IPV6_MAX_BYTELEN.

bgpd/ChangeLog
bgpd/bgp_attr.c
bgpd/bgp_attr.h

index 2267e0fac517dbdd24cbf76eeadaf537867936d9..d5822facf528e043f22f1b48a8866dbb5e1cd470 100644 (file)
          transit_hash_cmp, attrhash_key_make, attrhash_cmp,
          bgp_attr_hash_alloc) conforms to quagga hash API. Defines
          _hash_[alloc|key|cmp] with void * arguments as defined by the API.
+       * bgp_attr.h : Definition of BGP_ATTR_DEFAULT_WEIGHT.
+       * bgp_attr.c : (bgp_attr_default_intern) now uses 
+         bgp_attr_default_set instead of duplicating the same code.
+         (general) Use of BGP_ATTR_DEFAULT_WEIGHT. Replace two 16 by
+         IPV6_MAX_BYTELEN.
 
 2007-04-15 Sebastien Tandel <sebastien@tandel.be>
 
index b30c86ae1ed6ce9390a2da145b34b5aee97ae92b..28f01609cb1c8f7c8a4403382f98911fb5ae3534 100644 (file)
@@ -453,6 +453,7 @@ bgp_attr_intern (struct attr *attr)
   return find;
 }
 
+
 /* Make network statement's attribute. */
 struct attr *
 bgp_attr_default_set (struct attr *attr, u_char origin)
@@ -463,14 +464,16 @@ bgp_attr_default_set (struct attr *attr, u_char origin)
   attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGIN);
   attr->aspath = aspath_empty ();
   attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS_PATH);
-  attr->weight = 32768;
+  attr->weight = BGP_ATTR_DEFAULT_WEIGHT;
   attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
 #ifdef HAVE_IPV6
-  attr->mp_nexthop_len = 16;
+  attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
 #endif
+
   return attr;
 }
 
+
 /* Make network statement's attribute. */
 struct attr *
 bgp_attr_default_intern (u_char origin)
@@ -478,17 +481,7 @@ bgp_attr_default_intern (u_char origin)
   struct attr attr;
   struct attr *new;
 
-  memset (&attr, 0, sizeof (struct attr));
-
-  attr.origin = origin;
-  attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGIN);
-  attr.aspath = aspath_empty ();
-  attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AS_PATH);
-  attr.weight = 32768;
-  attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
-#ifdef HAVE_IPV6
-  attr.mp_nexthop_len = 16;
-#endif
+  bgp_attr_default_set(&attr, origin);
 
   new = bgp_attr_intern (&attr);
   aspath_unintern (new->aspath);
@@ -525,9 +518,9 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
       attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES);
     }
 
-  attr.weight = 32768;
+  attr.weight = BGP_ATTR_DEFAULT_WEIGHT;
 #ifdef HAVE_IPV6
-  attr.mp_nexthop_len = 16;
+  attr.mp_nexthop_len = IPV6_MAX_BYTELEN;
 #endif
   if (! as_set)
     attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE);
index 124c450e35c5276d4a3f9006a1751e94f8ab2747..0734bc270314d6999f9ed9ad803748b8d1ad944f 100644 (file)
@@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
 #define BGP_MED_MAX UINT32_MAX
 
+
 /* BGP Attribute type range. */
 #define BGP_ATTR_TYPE_RANGE     256
 #define BGP_ATTR_BITMAP_SIZE    (BGP_ATTR_TYPE_RANGE / BITMAP_NBBY)
@@ -45,6 +46,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 /* BGP attribute header must bigger than 2. */
 #define BGP_ATTR_MIN_LEN        2       /* Attribute flag and type. */
 
+#define BGP_ATTR_DEFAULT_WEIGHT 32768
+
 /* BGP attribute structure. */
 struct attr
 {