0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

The `bgp_origin' attribute is now an enum.

This commit is contained in:
Martin Mares 2000-04-28 15:13:29 +00:00
parent a412f01ea8
commit cea6366400
3 changed files with 15 additions and 5 deletions

View File

@ -490,9 +490,9 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p
a->flags = BAF_TRANSITIVE; a->flags = BAF_TRANSITIVE;
a->type = EAF_TYPE_INT; a->type = EAF_TYPE_INT;
if (rta->source == RTS_RIP_EXT || rta->source == RTS_OSPF_EXT) if (rta->source == RTS_RIP_EXT || rta->source == RTS_OSPF_EXT)
a->u.data = 2; /* Incomplete */ a->u.data = ORIGIN_INCOMPLETE;
else else
a->u.data = 0; /* IGP */ a->u.data = ORIGIN_IGP;
a++; a++;
a->id = EA_CODE(EAP_BGP, BA_AS_PATH); a->id = EA_CODE(EAP_BGP, BA_AS_PATH);
@ -638,8 +638,8 @@ bgp_rte_better(rte *new, rte *old)
/* Use origins */ /* Use origins */
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN)); x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_ORIGIN));
y = ea_find(old->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; n = x ? x->u.data : ORIGIN_INCOMPLETE;
o = y ? y->u.data : 2; o = y ? y->u.data : ORIGIN_INCOMPLETE;
if (n < o) if (n < o)
return 1; return 1;
if (n > o) if (n > o)

View File

@ -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_ADVERTISE 0xffffff02 /* Don't export at all */
#define BGP_COMM_NO_EXPORT_SUBCONFED 0xffffff03 /* NO_EXPORT even in local confederation */ #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 #endif

View File

@ -10,6 +10,8 @@ CF_HDR
#include "proto/bgp/bgp.h" #include "proto/bgp/bgp.h"
CF_DEFINES
#define BGP_CFG ((struct bgp_config *) this_proto) #define BGP_CFG ((struct bgp_config *) this_proto)
CF_DECLS CF_DECLS
@ -74,7 +76,7 @@ CF_ADDTO(dynamic_attr, BGP_LOCAL_PREF
CF_ADDTO(dynamic_attr, BGP_MED CF_ADDTO(dynamic_attr, BGP_MED
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(EAP_BGP, BA_MULTI_EXIT_DISC)); })
CF_ADDTO(dynamic_attr, BGP_ORIGIN 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 CF_ADDTO(dynamic_attr, BGP_NEXT_HOP
{ $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(EAP_BGP, BA_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 CF_ADDTO(dynamic_attr, BGP_ATOMIC_AGGR
@ -84,6 +86,8 @@ CF_ADDTO(dynamic_attr, BGP_AGGREGATOR
CF_ADDTO(dynamic_attr, BGP_COMMUNITY CF_ADDTO(dynamic_attr, BGP_COMMUNITY
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(EAP_BGP, BA_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_CODE
CF_END CF_END