]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/route_opaque.h
Merge pull request #11469 from donaldsharp/fdev2
[mirror_frr.git] / lib / route_opaque.h
index 599a0363eb2c94c2d26dea47ffc9e63332ad6234..bf6081c0547c1b9c1d8a06f1f37e67dfa134793c 100644 (file)
 #ifndef FRR_ROUTE_OPAQUE_H
 #define FRR_ROUTE_OPAQUE_H
 
-#include "bgpd/bgp_aspath.h"
-#include "bgpd/bgp_community.h"
-#include "bgpd/bgp_lcommunity.h"
+#include "assert.h"
+#include "zclient.h"
+
+/* copied from bgpd/bgp_community.h */
+#define COMMUNITY_SIZE 4
+/* copied from bgpd/bgp_lcommunity.h */
+#define LCOMMUNITY_SIZE 12
+/* copied from bgpd/bgp_route.h */
+#define BGP_MAX_SELECTION_REASON_STR_BUF 32
 
 struct bgp_zebra_opaque {
-       char aspath[ASPATH_STR_DEFAULT_LEN];
+       char aspath[256];
 
        /* Show at least 10 communities AA:BB */
        char community[COMMUNITY_SIZE * 20];
 
        /* Show at least 10 large-communities AA:BB:CC */
        char lcommunity[LCOMMUNITY_SIZE * 30];
+
+       /* 32 bytes seems enough because of
+        * bgp_path_selection_confed_as_path which is
+        * `Confederation based AS Path`.
+        */
+       char selection_reason[BGP_MAX_SELECTION_REASON_STR_BUF];
 };
 
+struct ospf_zebra_opaque {
+       char path_type[32];
+       char area_id[INET_ADDRSTRLEN];
+       char tag[16];
+};
+
+static_assert(sizeof(struct bgp_zebra_opaque) <= ZAPI_MESSAGE_OPAQUE_LENGTH,
+              "BGP opaque data shouldn't be larger than zebra's buffer");
+static_assert(sizeof(struct ospf_zebra_opaque) <= ZAPI_MESSAGE_OPAQUE_LENGTH,
+              "OSPF opaque data shouldn't be larger than zebra's buffer");
+
 #endif /* FRR_ROUTE_OPAQUE_H */