diff options
author | Martin Mares <mj@ucw.cz> | 2000-04-28 17:13:29 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-04-28 17:13:29 +0200 |
commit | cea636640005c9ee9b628ce07a2d467c132941fe (patch) | |
tree | 5ceba7f7ad159ce62efaafe5457eba2b712cb53f /proto | |
parent | a412f01ea84709b9af0113acc5aa2ce3dad1d292 (diff) | |
download | bird-cea636640005c9ee9b628ce07a2d467c132941fe.tar bird-cea636640005c9ee9b628ce07a2d467c132941fe.zip |
The `bgp_origin' attribute is now an enum.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bgp/attrs.c | 8 | ||||
-rw-r--r-- | proto/bgp/bgp.h | 6 | ||||
-rw-r--r-- | proto/bgp/config.Y | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 90da497..4136049 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -490,9 +490,9 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p a->flags = BAF_TRANSITIVE; a->type = EAF_TYPE_INT; if (rta->source == RTS_RIP_EXT || rta->source == RTS_OSPF_EXT) - a->u.data = 2; /* Incomplete */ + a->u.data = ORIGIN_INCOMPLETE; else - a->u.data = 0; /* IGP */ + a->u.data = ORIGIN_IGP; a++; a->id = EA_CODE(EAP_BGP, BA_AS_PATH); @@ -638,8 +638,8 @@ bgp_rte_better(rte *new, rte *old) /* Use origins */ x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN)); y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN)); - n = x ? x->u.data : 2; - o = y ? y->u.data : 2; + n = x ? x->u.data : ORIGIN_INCOMPLETE; + o = y ? y->u.data : ORIGIN_INCOMPLETE; if (n < o) return 1; if (n > o) diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 5c29488..2034df3 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -167,4 +167,10 @@ void bgp_log_error(struct bgp_proto *p, char *msg, unsigned code, unsigned subco #define BGP_COMM_NO_ADVERTISE 0xffffff02 /* Don't export at all */ #define BGP_COMM_NO_EXPORT_SUBCONFED 0xffffff03 /* NO_EXPORT even in local confederation */ +/* Origins */ + +#define ORIGIN_IGP 0 +#define ORIGIN_EGP 1 +#define ORIGIN_INCOMPLETE 2 + #endif diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index f670106..c4514d1 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -10,6 +10,8 @@ CF_HDR #include "proto/bgp/bgp.h" +CF_DEFINES + #define BGP_CFG ((struct bgp_config *) this_proto) CF_DECLS @@ -74,7 +76,7 @@ CF_ADDTO(dynamic_attr, BGP_LOCAL_PREF CF_ADDTO(dynamic_attr, BGP_MED { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC)); }) CF_ADDTO(dynamic_attr, BGP_ORIGIN - { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_ORIGIN)); }) + { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(EAP_BGP, BA_ORIGIN)); }) CF_ADDTO(dynamic_attr, BGP_NEXT_HOP { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(EAP_BGP, BA_NEXT_HOP)); }) CF_ADDTO(dynamic_attr, BGP_ATOMIC_AGGR @@ -84,6 +86,8 @@ CF_ADDTO(dynamic_attr, BGP_AGGREGATOR CF_ADDTO(dynamic_attr, BGP_COMMUNITY { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(EAP_BGP, BA_COMMUNITY)); }) +CF_ENUM(T_ENUM_BGP_ORIGIN, ORIGIN_, IGP, EGP, INCOMPLETE) + CF_CODE CF_END |