]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
The `bgp_origin' attribute is now an enum.
authorMartin Mares <mj@ucw.cz>
Fri, 28 Apr 2000 15:13:29 +0000 (15:13 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 28 Apr 2000 15:13:29 +0000 (15:13 +0000)
proto/bgp/attrs.c
proto/bgp/bgp.h
proto/bgp/config.Y

index 90da497e69892d7ccef4604e3a4e9253e97b28b5..4136049cd86c916b7e514102adf4285ed8f85748 100644 (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->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)
index 5c29488ab586bd991ed57cfdd1492806dbb2099f..2034df38df137c808c2646593bc7cf4cf7a5098c 100644 (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_EXPORT_SUBCONFED   0xffffff03      /* NO_EXPORT even in local confederation */
 
+/* Origins */
+
+#define ORIGIN_IGP             0
+#define ORIGIN_EGP             1
+#define ORIGIN_INCOMPLETE      2
+
 #endif
index f670106245e266c96de449590ee9e26b3b57d94b..c4514d1ca26cffd5b4a6c3d10f300ea8aa5435df 100644 (file)
@@ -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