version 1.1.1.2, 2012/10/09 09:22:28
|
version 1.1.1.3, 2016/11/02 10:09:10
|
Line 47 Software Foundation, Inc., 59 Temple Place - Suite 330
|
Line 47 Software Foundation, Inc., 59 Temple Place - Suite 330
|
#define BGP_ATTR_MIN_LEN 3 /* Attribute flag, type length. */ |
#define BGP_ATTR_MIN_LEN 3 /* Attribute flag, type length. */ |
#define BGP_ATTR_DEFAULT_WEIGHT 32768 |
#define BGP_ATTR_DEFAULT_WEIGHT 32768 |
|
|
|
struct bgp_attr_encap_subtlv { |
|
struct bgp_attr_encap_subtlv *next; /* for chaining */ |
|
uint16_t type; |
|
uint16_t length; |
|
uint8_t value[1]; /* will be extended */ |
|
}; |
|
|
/* Additional/uncommon BGP attributes. |
/* Additional/uncommon BGP attributes. |
* lazily allocated as and when a struct attr |
* lazily allocated as and when a struct attr |
* requires it. |
* requires it. |
Line 54 Software Foundation, Inc., 59 Temple Place - Suite 330
|
Line 61 Software Foundation, Inc., 59 Temple Place - Suite 330
|
struct attr_extra |
struct attr_extra |
{ |
{ |
/* Multi-Protocol Nexthop, AFI IPv6 */ |
/* Multi-Protocol Nexthop, AFI IPv6 */ |
#ifdef HAVE_IPV6 |
|
struct in6_addr mp_nexthop_global; |
struct in6_addr mp_nexthop_global; |
struct in6_addr mp_nexthop_local; |
struct in6_addr mp_nexthop_local; |
#endif /* HAVE_IPV6 */ |
|
|
|
/* Extended Communities attribute. */ |
/* Extended Communities attribute. */ |
struct ecommunity *ecommunity; |
struct ecommunity *ecommunity; |
Line 85 struct attr_extra
|
Line 90 struct attr_extra
|
|
|
/* MP Nexthop length */ |
/* MP Nexthop length */ |
u_char mp_nexthop_len; |
u_char mp_nexthop_len; |
|
|
|
uint16_t encap_tunneltype; /* grr */ |
|
struct bgp_attr_encap_subtlv *encap_subtlvs; /* rfc5512 */ |
}; |
}; |
|
|
/* BGP core attribute structure. */ |
/* BGP core attribute structure. */ |
Line 136 typedef enum {
|
Line 144 typedef enum {
|
BGP_ATTR_PARSE_PROCEED = 0, |
BGP_ATTR_PARSE_PROCEED = 0, |
BGP_ATTR_PARSE_ERROR = -1, |
BGP_ATTR_PARSE_ERROR = -1, |
BGP_ATTR_PARSE_WITHDRAW = -2, |
BGP_ATTR_PARSE_WITHDRAW = -2, |
|
|
|
/* only used internally, send notify + convert to BGP_ATTR_PARSE_ERROR */ |
|
BGP_ATTR_PARSE_ERROR_NOTIFYPLS = -3, |
} bgp_attr_parse_ret_t; |
} bgp_attr_parse_ret_t; |
|
|
/* Prototypes. */ |
/* Prototypes. */ |
Line 144 extern void bgp_attr_finish (void);
|
Line 155 extern void bgp_attr_finish (void);
|
extern bgp_attr_parse_ret_t bgp_attr_parse (struct peer *, struct attr *, |
extern bgp_attr_parse_ret_t bgp_attr_parse (struct peer *, struct attr *, |
bgp_size_t, struct bgp_nlri *, |
bgp_size_t, struct bgp_nlri *, |
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 struct attr_extra *bgp_attr_extra_get (struct attr *); |
extern void bgp_attr_extra_free (struct attr *); |
extern void bgp_attr_extra_free (struct attr *); |
extern void bgp_attr_dup (struct attr *, struct attr *); |
extern void bgp_attr_dup (struct attr *, struct attr *); |
Line 157 extern struct attr *bgp_attr_default_intern (u_char);
|
Line 167 extern struct attr *bgp_attr_default_intern (u_char);
|
extern struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char, |
extern struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char, |
struct aspath *, |
struct aspath *, |
struct community *, int as_set); |
struct community *, int as_set); |
extern bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *, | extern bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *, |
struct stream *, struct attr *, | struct stream *, struct attr *, |
struct prefix *, afi_t, safi_t, | struct prefix *, afi_t, safi_t, |
struct peer *, struct prefix_rd *, u_char *); | struct peer *, struct prefix_rd *, |
extern bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s, | u_char *); |
struct prefix *p, afi_t, safi_t, | |
struct prefix_rd *, u_char *); | |
extern void bgp_dump_routes_attr (struct stream *, struct attr *, |
extern void bgp_dump_routes_attr (struct stream *, struct attr *, |
struct prefix *); |
struct prefix *); |
extern int attrhash_cmp (const void *, const void *); |
extern int attrhash_cmp (const void *, const void *); |
Line 193 extern int bgp_mp_reach_parse (struct bgp_attr_parser_
|
Line 201 extern int bgp_mp_reach_parse (struct bgp_attr_parser_
|
struct bgp_nlri *); |
struct bgp_nlri *); |
extern int bgp_mp_unreach_parse (struct bgp_attr_parser_args *args, |
extern int bgp_mp_unreach_parse (struct bgp_attr_parser_args *args, |
struct bgp_nlri *); |
struct bgp_nlri *); |
|
|
|
extern struct bgp_attr_encap_subtlv * |
|
encap_tlv_dup(struct bgp_attr_encap_subtlv *orig); |
|
|
|
extern void |
|
bgp_attr_flush_encap(struct attr *attr); |
|
|
|
/** |
|
* Set of functions to encode MP_REACH_NLRI and MP_UNREACH_NLRI attributes. |
|
* Typical call sequence is to call _start(), followed by multiple _prefix(), |
|
* one for each NLRI that needs to be encoded into the UPDATE message, and |
|
* finally the _end() function. |
|
*/ |
|
extern size_t bgp_packet_mpattr_start(struct stream *s, afi_t afi, safi_t safi, |
|
struct attr *attr); |
|
extern void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi, |
|
struct prefix *p, struct prefix_rd *prd, |
|
u_char *tag); |
|
extern size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi, |
|
struct prefix *p); |
|
extern void bgp_packet_mpattr_end(struct stream *s, size_t sizep); |
|
|
|
extern size_t bgp_packet_mpunreach_start (struct stream *s, afi_t afi, |
|
safi_t safi); |
|
extern void bgp_packet_mpunreach_prefix (struct stream *s, struct prefix *p, |
|
afi_t afi, safi_t safi, struct prefix_rd *prd, |
|
u_char *tag); |
|
extern void bgp_packet_mpunreach_end (struct stream *s, size_t attrlen_pnt); |
|
|
#endif /* _QUAGGA_BGP_ATTR_H */ |
#endif /* _QUAGGA_BGP_ATTR_H */ |