diff options
Diffstat (limited to 'bgpd/bgp_attr.h')
-rw-r--r-- | bgpd/bgp_attr.h | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 0734bc27..ac14947f 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -45,24 +45,20 @@ 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 +/* Additional/uncommon BGP attributes. + * lazily allocated as and when a struct attr + * requires it. + */ +struct attr_extra { - /* Attributes. */ + /* Multi-Protocol Nexthop, AFI IPv6 */ #ifdef HAVE_IPV6 struct in6_addr mp_nexthop_global; struct in6_addr mp_nexthop_local; #endif /* HAVE_IPV6 */ - /* AS Path structure */ - struct aspath *aspath; - - /* Community structure */ - struct community *community; - /* Extended Communities attribute. */ struct ecommunity *ecommunity; @@ -72,6 +68,37 @@ struct attr /* Unknown transitive attribute. */ struct transit *transit; + struct in_addr mp_nexthop_global_in; + struct in_addr mp_nexthop_local_in; + + /* Aggregator Router ID attribute */ + struct in_addr aggregator_addr; + + /* Route Reflector Originator attribute */ + struct in_addr originator_id; + + /* Local weight, not actually an attribute */ + u_int32_t weight; + + /* Aggregator ASN */ + as_t aggregator_as; + + /* MP Nexthop length */ + u_char mp_nexthop_len; +}; + +/* BGP core attribute structure. */ +struct attr +{ + /* AS Path structure */ + struct aspath *aspath; + + /* Community structure */ + struct community *community; + + /* Lazily allocated pointer to extra attributes */ + struct attr_extra *extra; + /* Reference count of this attribute. */ unsigned long refcnt; @@ -82,14 +109,9 @@ struct attr struct in_addr nexthop; u_int32_t med; u_int32_t local_pref; - struct in_addr aggregator_addr; - struct in_addr originator_id; - struct in_addr mp_nexthop_global_in; - struct in_addr mp_nexthop_local_in; - u_int32_t weight; - as_t aggregator_as; + + /* Path origin attribute */ u_char origin; - u_char mp_nexthop_len; }; /* Router Reflector related structure. */ @@ -115,6 +137,9 @@ extern void bgp_attr_init (void); extern int bgp_attr_parse (struct peer *, struct attr *, bgp_size_t, struct bgp_nlri *, struct bgp_nlri *); extern int bgp_attr_check (struct peer *, struct attr *); +extern struct attr_extra *bgp_attr_extra_get (struct attr *); +extern void bgp_attr_extra_free (struct attr *); +extern void bgp_attr_dup (struct attr *, struct attr *); extern struct attr *bgp_attr_intern (struct attr *attr); extern void bgp_attr_unintern (struct attr *); extern void bgp_attr_flush (struct attr *); |