diff options
author | Paul Jakma <paul.jakma@sun.com> | 2007-04-29 18:31:07 +0000 |
---|---|---|
committer | Paul Jakma <paul.jakma@sun.com> | 2007-04-29 18:31:07 +0000 |
commit | 03e214c87bf4537576d2c7e9b2d812d1b0da2f56 (patch) | |
tree | 46f53f23bc77af0c8e6835853fbc355c3c342ddf /bgpd/bgp_attr.c | |
parent | 923de654c8d251d6714a6f9da2e93c236e935042 (diff) |
[bgpd] Use defines for default weight
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.
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r-- | bgpd/bgp_attr.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index b30c86ae..28f01609 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -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); |