diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:16:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:16:35 +0000 |
commit | e2bbf175a2184bd76f6c54ccf8456babeb1a46fc (patch) | |
tree | f0b76550d6e6f500ada964a3a4ee933a45e5a6f1 /lib/route_opaque.h | |
parent | Initial commit. (diff) | |
download | frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.tar.xz frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.zip |
Adding upstream version 9.1.upstream/9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/route_opaque.h')
-rw-r--r-- | lib/route_opaque.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/route_opaque.h b/lib/route_opaque.h new file mode 100644 index 0000000..82ff21c --- /dev/null +++ b/lib/route_opaque.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Opaque data for Zebra from other daemons. + * + * Copyright (C) 2021 Donatas Abraitis <donatas.abraitis@gmail.com> + */ + +#ifndef FRR_ROUTE_OPAQUE_H +#define FRR_ROUTE_OPAQUE_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[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 */ |